home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1989-06-19 | 32.4 KB | [TEXT/MPS ] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| ZX81 Sinclair BASIC (image/sinclairBASIC)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Applause Picture (image/applausePicture)
| ext
| Unsupported |
1%
| dexvert
| bsdiff patch (other/bsdiffPatch)
| ext
| Unsupported |
1%
| dexvert
| imgdiff patch (other/imgdiffPatch)
| ext
| Unsupported |
1%
| dexvert
| MATLAB p-code (other/matlabPCode)
| ext
| Unsupported |
1%
| dexvert
| WSUS Patch Storage File (other/wsusPatchStorageFile)
| ext
| Unsupported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Mon Jun 19 13:00:00 1989, modified Mon Jun 19 13:00:00 1989, creator 'MPS ', type ASCII, 32466 bytes "Sample.p" , at 0x7f52 435 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 53 61 6d 70 6c 65 | 2e 70 00 00 00 00 00 00 |..Sample|.p......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 80 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 7e d2 00 | 00 01 b3 a0 c2 d7 10 a0 |.....~..|........|
|00000060| c2 d7 10 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 35 dd 00 00 |........|....5...|
|00000080| 7b 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |{-------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0d |--------|-------.|
|000000d0| 23 0d 23 09 41 70 70 6c | 65 20 4d 61 63 69 6e 74 |#.#.Appl|e Macint|
|000000e0| 6f 73 68 20 44 65 76 65 | 6c 6f 70 65 72 20 54 65 |osh Deve|loper Te|
|000000f0| 63 68 6e 69 63 61 6c 20 | 53 75 70 70 6f 72 74 0d |chnical |Support.|
|00000100| 23 0d 23 09 4d 75 6c 74 | 69 46 69 6e 64 65 72 2d |#.#.Mult|iFinder-|
|00000110| 41 77 61 72 65 20 53 69 | 6d 70 6c 65 20 53 61 6d |Aware Si|mple Sam|
|00000120| 70 6c 65 20 41 70 70 6c | 69 63 61 74 69 6f 6e 0d |ple Appl|ication.|
|00000130| 23 0d 23 09 53 61 6d 70 | 6c 65 0d 23 0d 23 09 53 |#.#.Samp|le.#.#.S|
|00000140| 61 6d 70 6c 65 2e 70 09 | 2d 09 50 61 73 63 61 6c |ample.p.|-.Pascal|
|00000150| 20 53 6f 75 72 63 65 0d | 23 0d 23 09 43 6f 70 79 | Source.|#.#.Copy|
|00000160| 72 69 67 68 74 20 a9 20 | 31 39 38 39 20 41 70 70 |right . |1989 App|
|00000170| 6c 65 20 43 6f 6d 70 75 | 74 65 72 2c 20 49 6e 63 |le Compu|ter, Inc|
|00000180| 2e 0d 23 09 41 6c 6c 20 | 72 69 67 68 74 73 20 72 |..#.All |rights r|
|00000190| 65 73 65 72 76 65 64 2e | 0d 23 0d 23 09 56 65 72 |eserved.|.#.#.Ver|
|000001a0| 73 69 6f 6e 73 3a 09 0d | 23 09 09 09 09 31 2e 30 |sions:..|#....1.0|
|000001b0| 30 09 09 09 09 30 38 2f | 38 38 0d 23 09 09 09 09 |0....08/|88.#....|
|000001c0| 31 2e 30 31 09 09 09 09 | 31 31 2f 38 38 0d 23 09 |1.01....|11/88.#.|
|000001d0| 09 09 09 31 2e 30 32 09 | 09 09 09 30 34 2f 38 39 |...1.02.|...04/89|
|000001e0| 09 4d 50 57 20 33 2e 31 | 0d 23 0d 23 09 43 6f 6d |.MPW 3.1|.#.#.Com|
|000001f0| 70 6f 6e 65 6e 74 73 3a | 0d 23 09 09 09 09 53 61 |ponents:|.#....Sa|
|00000200| 6d 70 6c 65 2e 70 09 09 | 09 41 70 72 69 6c 20 31 |mple.p..|.April 1|
|00000210| 2c 20 31 39 38 39 0d 23 | 09 09 09 09 53 61 6d 70 |, 1989.#|....Samp|
|00000220| 6c 65 2e 63 09 09 09 41 | 70 72 69 6c 20 31 2c 20 |le.c...A|pril 1, |
|00000230| 31 39 38 39 0d 23 09 09 | 09 09 53 61 6d 70 6c 65 |1989.#..|..Sample|
|00000240| 2e 61 09 09 09 41 70 72 | 69 6c 20 31 2c 20 31 39 |.a...Apr|il 1, 19|
|00000250| 38 39 0d 23 09 09 09 09 | 53 61 6d 70 6c 65 2e 69 |89.#....|Sample.i|
|00000260| 6e 63 31 2e 61 09 09 41 | 70 72 69 6c 20 31 2c 20 |nc1.a..A|pril 1, |
|00000270| 31 39 38 39 0d 23 09 09 | 09 09 53 61 6d 70 6c 65 |1989.#..|..Sample|
|00000280| 4d 69 73 63 2e 61 09 09 | 41 70 72 69 6c 20 31 2c |Misc.a..|April 1,|
|00000290| 20 31 39 38 39 0d 23 09 | 09 09 09 53 61 6d 70 6c | 1989.#.|...Sampl|
|000002a0| 65 2e 72 09 09 09 41 70 | 72 69 6c 20 31 2c 20 31 |e.r...Ap|ril 1, 1|
|000002b0| 39 38 39 0d 23 09 09 09 | 09 53 61 6d 70 6c 65 2e |989.#...|.Sample.|
|000002c0| 68 09 09 09 41 70 72 69 | 6c 20 31 2c 20 31 39 38 |h...Apri|l 1, 198|
|000002d0| 39 0d 23 09 09 09 09 5b | 50 5d 53 61 6d 70 6c 65 |9.#....[|P]Sample|
|000002e0| 2e 6d 61 6b 65 09 09 41 | 70 72 69 6c 20 31 2c 20 |.make..A|pril 1, |
|000002f0| 31 39 38 39 0d 23 09 09 | 09 09 5b 43 5d 53 61 6d |1989.#..|..[C]Sam|
|00000300| 70 6c 65 2e 6d 61 6b 65 | 09 09 41 70 72 69 6c 20 |ple.make|..April |
|00000310| 31 2c 20 31 39 38 39 0d | 23 09 09 09 09 5b 41 5d |1, 1989.|#....[A]|
|00000320| 53 61 6d 70 6c 65 2e 6d | 61 6b 65 09 09 41 70 72 |Sample.m|ake..Apr|
|00000330| 69 6c 20 31 2c 20 31 39 | 38 39 0d 23 0d 23 09 53 |il 1, 19|89.#.#.S|
|00000340| 61 6d 70 6c 65 20 69 73 | 20 61 6e 20 65 78 61 6d |ample is| an exam|
|00000350| 70 6c 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |ple appl|ication |
|00000360| 74 68 61 74 20 64 65 6d | 6f 6e 73 74 72 61 74 65 |that dem|onstrate|
|00000370| 73 20 68 6f 77 20 74 6f | 0d 23 09 69 6e 69 74 69 |s how to|.#.initi|
|00000380| 61 6c 69 7a 65 20 74 68 | 65 20 63 6f 6d 6d 6f 6e |alize th|e common|
|00000390| 6c 79 20 75 73 65 64 20 | 74 6f 6f 6c 62 6f 78 20 |ly used |toolbox |
|000003a0| 6d 61 6e 61 67 65 72 73 | 2c 20 6f 70 65 72 61 74 |managers|, operat|
|000003b0| 65 20 0d 23 09 73 75 63 | 63 65 73 73 66 75 6c 6c |e .#.suc|cessfull|
|000003c0| 79 20 75 6e 64 65 72 20 | 4d 75 6c 74 69 46 69 6e |y under |MultiFin|
|000003d0| 64 65 72 2c 20 68 61 6e | 64 6c 65 20 64 65 73 6b |der, han|dle desk|
|000003e0| 20 61 63 63 65 73 73 6f | 72 69 65 73 2c 20 0d 23 | accesso|ries, .#|
|000003f0| 09 61 6e 64 20 63 72 65 | 61 74 65 2c 20 67 72 6f |.and cre|ate, gro|
|00000400| 77 2c 20 61 6e 64 20 7a | 6f 6f 6d 20 77 69 6e 64 |w, and z|oom wind|
|00000410| 6f 77 73 2e 0d 23 0d 23 | 09 49 74 20 64 6f 65 73 |ows..#.#|.It does|
|00000420| 20 6e 6f 74 20 62 79 20 | 61 6e 79 20 6d 65 61 6e | not by |any mean|
|00000430| 73 20 64 65 6d 6f 6e 73 | 74 72 61 74 65 20 61 6c |s demons|trate al|
|00000440| 6c 20 74 68 65 20 74 65 | 63 68 6e 69 71 75 65 73 |l the te|chniques|
|00000450| 20 0d 23 09 79 6f 75 20 | 6e 65 65 64 20 66 6f 72 | .#.you |need for|
|00000460| 20 61 20 6c 61 72 67 65 | 20 61 70 70 6c 69 63 61 | a large| applica|
|00000470| 74 69 6f 6e 2e 20 49 6e | 20 70 61 72 74 69 63 75 |tion. In| particu|
|00000480| 6c 61 72 2c 20 53 61 6d | 70 6c 65 20 0d 23 09 64 |lar, Sam|ple .#.d|
|00000490| 6f 65 73 20 6e 6f 74 20 | 63 6f 76 65 72 20 65 78 |oes not |cover ex|
|000004a0| 63 65 70 74 69 6f 6e 20 | 68 61 6e 64 6c 69 6e 67 |ception |handling|
|000004b0| 2c 20 6d 75 6c 74 69 70 | 6c 65 20 77 69 6e 64 6f |, multip|le windo|
|000004c0| 77 73 2f 64 6f 63 75 6d | 65 6e 74 73 2c 20 0d 23 |ws/docum|ents, .#|
|000004d0| 09 73 6f 70 68 69 73 74 | 69 63 61 74 65 64 20 6d |.sophist|icated m|
|000004e0| 65 6d 6f 72 79 20 6d 61 | 6e 61 67 65 6d 65 6e 74 |emory ma|nagement|
|000004f0| 2c 20 70 72 69 6e 74 69 | 6e 67 2c 20 6f 72 20 75 |, printi|ng, or u|
|00000500| 6e 64 6f 2e 20 41 6c 6c | 20 6f 66 20 0d 23 09 74 |ndo. All| of .#.t|
|00000510| 68 65 73 65 20 61 72 65 | 20 76 69 74 61 6c 20 70 |hese are| vital p|
|00000520| 61 72 74 73 20 6f 66 20 | 61 20 6e 6f 72 6d 61 6c |arts of |a normal|
|00000530| 20 66 75 6c 6c 2d 73 69 | 7a 65 64 20 61 70 70 6c | full-si|zed appl|
|00000540| 69 63 61 74 69 6f 6e 2e | 0d 23 0d 23 09 54 68 69 |ication.|.#.#.Thi|
|00000550| 73 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 69 73 |s applic|ation is|
|00000560| 20 61 6e 20 65 78 61 6d | 70 6c 65 20 6f 66 20 74 | an exam|ple of t|
|00000570| 68 65 20 66 6f 72 6d 20 | 6f 66 20 61 20 4d 61 63 |he form |of a Mac|
|00000580| 69 6e 74 6f 73 68 20 0d | 23 09 61 70 70 6c 69 63 |intosh .|#.applic|
|00000590| 61 74 69 6f 6e 3b 20 69 | 74 20 69 73 20 4e 4f 54 |ation; i|t is NOT|
|000005a0| 20 61 20 74 65 6d 70 6c | 61 74 65 2e 20 49 74 20 | a templ|ate. It |
|000005b0| 69 73 20 4e 4f 54 20 69 | 6e 74 65 6e 64 65 64 20 |is NOT i|ntended |
|000005c0| 74 6f 20 62 65 20 0d 23 | 09 75 73 65 64 20 61 73 |to be .#|.used as|
|000005d0| 20 61 20 66 6f 75 6e 64 | 61 74 69 6f 6e 20 66 6f | a found|ation fo|
|000005e0| 72 20 74 68 65 20 6e 65 | 78 74 20 77 6f 72 6c 64 |r the ne|xt world|
|000005f0| 2d 63 6c 61 73 73 2c 20 | 62 65 73 74 2d 73 65 6c |-class, |best-sel|
|00000600| 6c 69 6e 67 2c 20 0d 23 | 09 36 30 30 4b 20 61 70 |ling, .#|.600K ap|
|00000610| 70 6c 69 63 61 74 69 6f | 6e 2e 20 41 20 73 74 69 |plicatio|n. A sti|
|00000620| 63 6b 20 66 69 67 75 72 | 65 20 64 72 61 77 69 6e |ck figur|e drawin|
|00000630| 67 20 6f 66 20 74 68 65 | 20 68 75 6d 61 6e 20 62 |g of the| human b|
|00000640| 6f 64 79 20 6d 61 79 20 | 0d 23 09 62 65 20 61 20 |ody may |.#.be a |
|00000650| 67 6f 6f 64 20 65 78 61 | 6d 70 6c 65 20 6f 66 20 |good exa|mple of |
|00000660| 74 68 65 20 66 6f 72 6d | 20 66 6f 72 20 61 20 70 |the form| for a p|
|00000670| 61 69 6e 74 69 6e 67 2c | 20 62 75 74 20 74 68 61 |ainting,| but tha|
|00000680| 74 20 64 6f 65 73 20 6e | 6f 74 20 0d 23 09 6d 65 |t does n|ot .#.me|
|00000690| 61 6e 20 69 74 20 73 68 | 6f 75 6c 64 20 62 65 20 |an it sh|ould be |
|000006a0| 75 73 65 64 20 61 73 20 | 74 68 65 20 62 61 73 69 |used as |the basi|
|000006b0| 73 20 66 6f 72 20 74 68 | 65 20 6e 65 78 74 20 4d |s for th|e next M|
|000006c0| 6f 6e 61 20 4c 69 73 61 | 2e 0d 23 0d 23 09 57 65 |ona Lisa|..#.#.We|
|000006d0| 20 72 65 63 6f 6d 6d 65 | 6e 64 20 74 68 61 74 20 | recomme|nd that |
|000006e0| 79 6f 75 20 72 65 76 69 | 65 77 20 74 68 69 73 20 |you revi|ew this |
|000006f0| 70 72 6f 67 72 61 6d 20 | 6f 72 20 54 45 53 61 6d |program |or TESam|
|00000700| 70 6c 65 20 62 65 66 6f | 72 65 20 0d 23 09 62 65 |ple befo|re .#.be|
|00000710| 67 69 6e 6e 69 6e 67 20 | 61 20 6e 65 77 20 61 70 |ginning |a new ap|
|00000720| 70 6c 69 63 61 74 69 6f | 6e 2e 0d 23 0d 2d 2d 2d |plicatio|n..#.---|
|00000730| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000740| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000750| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000760| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000770| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 7d 0d 0d 0d 50 |--------|---}...P|
|00000780| 52 4f 47 52 41 4d 20 53 | 61 6d 70 6c 65 3b 0d 0d |ROGRAM S|ample;..|
|00000790| 0d 7b 53 65 67 6d 65 6e | 74 61 74 69 6f 6e 20 73 |.{Segmen|tation s|
|000007a0| 74 72 61 74 65 67 79 3a | 0d 0d 20 54 68 69 73 20 |trategy:|.. This |
|000007b0| 70 72 6f 67 72 61 6d 20 | 63 6f 6e 73 69 73 74 73 |program |consists|
|000007c0| 20 6f 66 20 74 68 72 65 | 65 20 73 65 67 6d 65 6e | of thre|e segmen|
|000007d0| 74 73 2e 20 4d 61 69 6e | 20 63 6f 6e 74 61 69 6e |ts. Main| contain|
|000007e0| 73 20 6d 6f 73 74 20 6f | 66 20 74 68 65 20 63 6f |s most o|f the co|
|000007f0| 64 65 2c 0d 20 69 6e 63 | 6c 75 64 69 6e 67 20 74 |de,. inc|luding t|
|00000800| 68 65 20 4d 50 57 20 6c | 69 62 72 61 72 69 65 73 |he MPW l|ibraries|
|00000810| 2c 20 61 6e 64 20 74 68 | 65 20 6d 61 69 6e 20 70 |, and th|e main p|
|00000820| 72 6f 67 72 61 6d 2e 20 | 49 6e 69 74 69 61 6c 69 |rogram. |Initiali|
|00000830| 7a 65 20 63 6f 6e 74 61 | 69 6e 73 0d 20 63 6f 64 |ze conta|ins. cod|
|00000840| 65 20 74 68 61 74 20 69 | 73 20 6f 6e 6c 79 20 75 |e that i|s only u|
|00000850| 73 65 64 20 6f 6e 63 65 | 2c 20 64 75 72 69 6e 67 |sed once|, during|
|00000860| 20 73 74 61 72 74 75 70 | 2c 20 61 6e 64 20 63 61 | startup|, and ca|
|00000870| 6e 20 62 65 20 75 6e 6c | 6f 61 64 65 64 20 61 66 |n be unl|oaded af|
|00000880| 74 65 72 20 74 68 65 0d | 20 70 72 6f 67 72 61 6d |ter the.| program|
|00000890| 20 73 74 61 72 74 73 2e | 20 25 41 35 49 6e 69 74 | starts.| %A5Init|
|000008a0| 20 69 73 20 61 75 74 6f | 6d 61 74 69 63 61 6c 6c | is auto|maticall|
|000008b0| 79 20 63 72 65 61 74 65 | 64 20 62 79 20 74 68 65 |y create|d by the|
|000008c0| 20 4c 69 6e 6b 65 72 20 | 74 6f 20 69 6e 69 74 69 | Linker |to initi|
|000008d0| 61 6c 69 7a 65 0d 20 67 | 6c 6f 62 61 6c 73 20 66 |alize. g|lobals f|
|000008e0| 6f 72 20 74 68 65 20 4d | 50 57 20 6c 69 62 72 61 |or the M|PW libra|
|000008f0| 72 69 65 73 20 61 6e 64 | 20 69 73 20 75 6e 6c 6f |ries and| is unlo|
|00000900| 61 64 65 64 20 72 69 67 | 68 74 20 61 77 61 79 2e |aded rig|ht away.|
|00000910| 7d 0d 0d 0d 7b 53 65 74 | 50 6f 72 74 20 73 74 72 |}...{Set|Port str|
|00000920| 61 74 65 67 79 3a 0d 0d | 20 54 6f 6f 6c 62 6f 78 |ategy:..| Toolbox|
|00000930| 20 72 6f 75 74 69 6e 65 | 73 20 64 6f 20 6e 6f 74 | routine|s do not|
|00000940| 20 63 68 61 6e 67 65 20 | 74 68 65 20 63 75 72 72 | change |the curr|
|00000950| 65 6e 74 20 70 6f 72 74 | 2e 20 49 6e 20 73 70 69 |ent port|. In spi|
|00000960| 74 65 20 6f 66 20 74 68 | 69 73 2c 20 69 6e 20 74 |te of th|is, in t|
|00000970| 68 69 73 0d 20 70 72 6f | 67 72 61 6d 20 77 65 20 |his. pro|gram we |
|00000980| 75 73 65 20 61 20 73 74 | 72 61 74 65 67 79 20 6f |use a st|rategy o|
|00000990| 66 20 63 61 6c 6c 69 6e | 67 20 53 65 74 50 6f 72 |f callin|g SetPor|
|000009a0| 74 20 77 68 65 6e 65 76 | 65 72 20 77 65 20 77 61 |t whenev|er we wa|
|000009b0| 6e 74 20 74 6f 20 64 72 | 61 77 20 6f 72 0d 20 6d |nt to dr|aw or. m|
|000009c0| 61 6b 65 20 63 61 6c 6c | 73 20 77 68 69 63 68 20 |ake call|s which |
|000009d0| 64 65 70 65 6e 64 20 6f | 6e 20 74 68 65 20 63 75 |depend o|n the cu|
|000009e0| 72 72 65 6e 74 20 70 6f | 72 74 2e 20 54 68 69 73 |rrent po|rt. This|
|000009f0| 20 6d 61 6b 65 73 20 75 | 73 20 6c 65 73 73 20 76 | makes u|s less v|
|00000a00| 75 6c 6e 65 72 61 62 6c | 65 0d 20 74 6f 20 62 75 |ulnerabl|e. to bu|
|00000a10| 67 73 20 69 6e 20 6f 74 | 68 65 72 20 73 6f 66 74 |gs in ot|her soft|
|00000a20| 77 61 72 65 20 77 68 69 | 63 68 20 6d 69 67 68 74 |ware whi|ch might|
|00000a30| 20 61 6c 74 65 72 20 74 | 68 65 20 63 75 72 72 65 | alter t|he curre|
|00000a40| 6e 74 20 70 6f 72 74 20 | 28 73 75 63 68 20 61 73 |nt port |(such as|
|00000a50| 20 74 68 65 0d 20 62 75 | 67 20 28 66 65 61 74 75 | the. bu|g (featu|
|00000a60| 72 65 3f 29 20 69 6e 20 | 6d 61 6e 79 20 64 65 73 |re?) in |many des|
|00000a70| 6b 20 61 63 63 65 73 73 | 6f 72 69 65 73 20 77 68 |k access|ories wh|
|00000a80| 69 63 68 20 63 68 61 6e | 67 65 20 74 68 65 20 70 |ich chan|ge the p|
|00000a90| 6f 72 74 20 6f 6e 20 4f | 70 65 6e 44 65 73 6b 41 |ort on O|penDeskA|
|00000aa0| 63 63 29 2e 0d 20 48 6f | 70 65 66 75 6c 6c 79 2c |cc).. Ho|pefully,|
|00000ab0| 20 74 68 69 73 20 61 6c | 73 6f 20 6d 61 6b 65 73 | this al|so makes|
|00000ac0| 20 74 68 65 20 72 6f 75 | 74 69 6e 65 73 20 66 72 | the rou|tines fr|
|00000ad0| 6f 6d 20 74 68 69 73 20 | 70 72 6f 67 72 61 6d 20 |om this |program |
|00000ae0| 6d 6f 72 65 20 73 65 6c | 66 2d 63 6f 6e 74 61 69 |more sel|f-contai|
|00000af0| 6e 65 64 2c 0d 20 73 69 | 6e 63 65 20 74 68 65 79 |ned,. si|nce they|
|00000b00| 20 64 6f 6e 27 74 20 64 | 65 70 65 6e 64 20 6f 6e | don't d|epend on|
|00000b10| 20 74 68 65 20 63 75 72 | 72 65 6e 74 20 70 6f 72 | the cur|rent por|
|00000b20| 74 20 73 65 74 74 69 6e | 67 2e 7d 0d 0d 0d 55 53 |t settin|g.}...US|
|00000b30| 45 53 0d 09 4d 65 6d 54 | 79 70 65 73 2c 20 51 75 |ES..MemT|ypes, Qu|
|00000b40| 69 63 6b 44 72 61 77 2c | 20 4f 53 49 6e 74 66 2c |ickDraw,| OSIntf,|
|00000b50| 20 54 6f 6f 6c 49 6e 74 | 66 2c 20 50 61 63 6b 49 | ToolInt|f, PackI|
|00000b60| 6e 74 66 2c 20 54 72 61 | 70 73 3b 0d 0d 43 4f 4e |ntf, Tra|ps;..CON|
|00000b70| 53 54 0d 09 7b 4d 50 57 | 20 33 2e 30 20 77 69 6c |ST..{MPW| 3.0 wil|
|00000b80| 6c 20 69 6e 63 6c 75 64 | 65 20 61 20 54 72 61 70 |l includ|e a Trap|
|00000b90| 73 2e 70 20 69 6e 74 65 | 72 66 61 63 65 20 66 69 |s.p inte|rface fi|
|00000ba0| 6c 65 20 74 68 61 74 20 | 69 6e 63 6c 75 64 65 73 |le that |includes|
|00000bb0| 20 63 6f 6e 73 74 61 6e | 74 73 20 66 6f 72 20 74 | constan|ts for t|
|00000bc0| 72 61 70 20 6e 75 6d 62 | 65 72 73 2e 0d 09 20 54 |rap numb|ers... T|
|00000bd0| 68 65 73 65 20 63 6f 6e | 73 74 61 6e 74 73 20 61 |hese con|stants a|
|00000be0| 72 65 20 66 72 6f 6d 20 | 74 68 61 74 20 66 69 6c |re from |that fil|
|00000bf0| 65 2e 7d 0d 09 7b 31 2e | 30 32 20 2d 20 73 69 6e |e.}..{1.|02 - sin|
|00000c00| 63 65 20 75 73 69 6e 67 | 20 4d 50 57 20 33 2e 30 |ce using| MPW 3.0|
|00000c10| 20 6f 6e 6c 79 2c 20 77 | 65 20 69 6e 63 6c 75 64 | only, w|e includ|
|00000c20| 65 20 54 72 61 70 73 2e | 70 2c 20 73 6f 20 77 65 |e Traps.|p, so we|
|00000c30| 20 6e 6f 77 20 68 61 76 | 65 20 74 72 61 70 20 6e | now hav|e trap n|
|00000c40| 75 6d 62 65 72 73 2e 7d | 0d 0d 09 7b 31 2e 30 31 |umbers.}|...{1.01|
|00000c50| 20 2d 20 63 68 61 6e 67 | 65 64 20 63 6f 6e 73 74 | - chang|ed const|
|00000c60| 61 6e 74 73 20 74 6f 20 | 62 65 67 69 6e 20 77 69 |ants to |begin wi|
|00000c70| 74 68 20 27 6b 27 20 66 | 6f 72 20 63 6f 6e 73 69 |th 'k' f|or consi|
|00000c80| 73 74 65 6e 63 79 2c 20 | 65 78 63 65 70 74 20 66 |stency, |except f|
|00000c90| 6f 72 20 72 65 73 6f 75 | 72 63 65 20 49 44 73 7d |or resou|rce IDs}|
|00000ca0| 0d 09 7b 53 79 73 45 6e | 76 69 72 6f 6e 73 56 65 |..{SysEn|vironsVe|
|00000cb0| 72 73 69 6f 6e 20 69 73 | 20 70 61 73 73 65 64 20 |rsion is| passed |
|00000cc0| 74 6f 20 53 79 73 45 6e | 76 69 72 6f 6e 73 20 74 |to SysEn|virons t|
|00000cd0| 6f 20 74 65 6c 6c 20 69 | 74 20 77 68 69 63 68 20 |o tell i|t which |
|00000ce0| 76 65 72 73 69 6f 6e 20 | 6f 66 20 74 68 65 0d 09 |version |of the..|
|00000cf0| 20 53 79 73 45 6e 76 52 | 65 63 20 77 65 20 75 6e | SysEnvR|ec we un|
|00000d00| 64 65 72 73 74 61 6e 64 | 2e 7d 0d 09 6b 53 79 73 |derstand|.}..kSys|
|00000d10| 45 6e 76 69 72 6f 6e 73 | 56 65 72 73 69 6f 6e 09 |Environs|Version.|
|00000d20| 09 3d 20 31 3b 0d 0d 09 | 7b 4f 53 45 76 65 6e 74 |.= 1;...|{OSEvent|
|00000d30| 20 69 73 20 74 68 65 20 | 65 76 65 6e 74 20 6e 75 | is the |event nu|
|00000d40| 6d 62 65 72 20 6f 66 20 | 74 68 65 20 73 75 73 70 |mber of |the susp|
|00000d50| 65 6e 64 2f 72 65 73 75 | 6d 65 20 61 6e 64 20 6d |end/resu|me and m|
|00000d60| 6f 75 73 65 2d 6d 6f 76 | 65 64 20 65 76 65 6e 74 |ouse-mov|ed event|
|00000d70| 73 20 73 65 6e 74 0d 09 | 20 62 79 20 4d 75 6c 74 |s sent..| by Mult|
|00000d80| 69 46 69 6e 64 65 72 2e | 20 4f 6e 63 65 20 77 65 |iFinder.| Once we|
|00000d90| 20 64 65 74 65 72 6d 69 | 6e 65 20 74 68 61 74 20 | determi|ne that |
|00000da0| 61 6e 20 65 76 65 6e 74 | 20 69 73 20 61 6e 20 6f |an event| is an o|
|00000db0| 73 45 76 65 6e 74 2c 20 | 77 65 20 6c 6f 6f 6b 20 |sEvent, |we look |
|00000dc0| 61 74 20 74 68 65 0d 09 | 20 68 69 67 68 20 62 79 |at the..| high by|
|00000dd0| 74 65 20 6f 66 20 74 68 | 65 20 6d 65 73 73 61 67 |te of th|e messag|
|00000de0| 65 20 73 65 6e 74 20 74 | 6f 20 64 65 74 65 72 6d |e sent t|o determ|
|00000df0| 69 6e 65 20 77 68 69 63 | 68 20 6b 69 6e 64 20 69 |ine whic|h kind i|
|00000e00| 74 20 69 73 2e 20 54 6f | 20 64 69 66 66 65 72 65 |t is. To| differe|
|00000e10| 6e 74 69 61 74 65 0d 09 | 20 73 75 73 70 65 6e 64 |ntiate..| suspend|
|00000e20| 20 61 6e 64 20 72 65 73 | 75 6d 65 20 65 76 65 6e | and res|ume even|
|00000e30| 74 73 20 77 65 20 63 68 | 65 63 6b 20 74 68 65 20 |ts we ch|eck the |
|00000e40| 72 65 73 75 6d 65 4d 61 | 73 6b 20 62 69 74 2e 7d |resumeMa|sk bit.}|
|00000e50| 0d 09 6b 4f 53 45 76 65 | 6e 74 09 09 09 09 3d 20 |..kOSEve|nt....= |
|00000e60| 61 70 70 34 45 76 74 3b | 09 7b 65 76 65 6e 74 20 |app4Evt;|.{event |
|00000e70| 75 73 65 64 20 62 79 20 | 4d 75 6c 74 69 46 69 6e |used by |MultiFin|
|00000e80| 64 65 72 7d 0d 09 6b 53 | 75 73 70 65 6e 64 52 65 |der}..kS|uspendRe|
|00000e90| 73 75 6d 65 4d 65 73 73 | 61 67 65 09 3d 20 31 3b |sumeMess|age.= 1;|
|00000ea0| 09 09 7b 68 69 67 68 20 | 62 79 74 65 20 6f 66 20 |..{high |byte of |
|00000eb0| 73 75 73 70 65 6e 64 2f | 72 65 73 75 6d 65 20 65 |suspend/|resume e|
|00000ec0| 76 65 6e 74 20 6d 65 73 | 73 61 67 65 7d 0d 09 6b |vent mes|sage}..k|
|00000ed0| 52 65 73 75 6d 65 4d 61 | 73 6b 09 09 09 09 3d 20 |ResumeMa|sk....= |
|00000ee0| 31 3b 09 09 7b 62 69 74 | 20 6f 66 20 6d 65 73 73 |1;..{bit| of mess|
|00000ef0| 61 67 65 20 66 69 65 6c | 64 20 66 6f 72 20 72 65 |age fiel|d for re|
|00000f00| 73 75 6d 65 20 76 73 2e | 20 73 75 73 70 65 6e 64 |sume vs.| suspend|
|00000f10| 7d 0d 09 6b 4e 6f 45 76 | 65 6e 74 73 09 09 09 09 |}..kNoEv|ents....|
|00000f20| 3d 20 30 3b 09 09 7b 6e | 6f 20 65 76 65 6e 74 73 |= 0;..{n|o events|
|00000f30| 20 6d 61 73 6b 7d 0d 0d | 09 7b 31 2e 30 31 20 2d | mask}..|.{1.01 -|
|00000f40| 20 6b 4d 69 6e 48 65 61 | 70 20 2d 20 54 68 69 73 | kMinHea|p - This|
|00000f50| 20 69 73 20 74 68 65 20 | 6d 69 6e 69 6d 75 6d 20 | is the |minimum |
|00000f60| 72 65 73 75 6c 74 20 66 | 72 6f 6d 20 74 68 65 20 |result f|rom the |
|00000f70| 66 6f 6c 6c 6f 77 69 6e | 67 0d 09 20 65 71 75 61 |followin|g.. equa|
|00000f80| 74 69 6f 6e 3a 0d 09 09 | 09 0d 09 09 09 4f 52 44 |tion:...|.....ORD|
|00000f90| 28 47 65 74 41 70 70 6c | 4c 69 6d 69 74 29 20 2d |(GetAppl|Limit) -|
|00000fa0| 20 4f 52 44 28 41 70 70 | 6c 69 63 5a 6f 6e 65 29 | ORD(App|licZone)|
|00000fb0| 0d 09 09 09 0d 09 20 66 | 6f 72 20 74 68 65 20 61 |...... f|or the a|
|00000fc0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 74 6f 20 72 75 |pplicati|on to ru|
|00000fd0| 6e 2e 20 49 74 20 77 69 | 6c 6c 20 69 6e 73 75 72 |n. It wi|ll insur|
|00000fe0| 65 20 74 68 61 74 20 65 | 6e 6f 75 67 68 20 6d 65 |e that e|nough me|
|00000ff0| 6d 6f 72 79 20 77 69 6c | 6c 0d 09 20 62 65 20 61 |mory wil|l.. be a|
|00001000| 72 6f 75 6e 64 20 66 6f | 72 20 72 65 61 73 6f 6e |round fo|r reason|
|00001010| 61 62 6c 65 2d 73 69 7a | 65 64 20 73 63 72 61 70 |able-siz|ed scrap|
|00001020| 73 2c 20 46 4b 45 59 73 | 2c 20 65 74 63 2e 20 74 |s, FKEYs|, etc. t|
|00001030| 6f 20 65 78 69 73 74 20 | 77 69 74 68 20 74 68 65 |o exist |with the|
|00001040| 0d 09 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 2c 20 |.. appli|cation, |
|00001050| 61 6e 64 20 73 74 69 6c | 6c 20 67 69 76 65 20 74 |and stil|l give t|
|00001060| 68 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 73 |he appli|cation s|
|00001070| 6f 6d 65 20 27 62 72 65 | 61 74 68 69 6e 67 20 72 |ome 'bre|athing r|
|00001080| 6f 6f 6d 27 2e 0d 09 20 | 54 6f 20 64 65 72 69 76 |oom'... |To deriv|
|00001090| 65 20 74 68 69 73 20 6e | 75 6d 62 65 72 2c 20 77 |e this n|umber, w|
|000010a0| 65 20 72 61 6e 20 75 6e | 64 65 72 20 61 20 4d 75 |e ran un|der a Mu|
|000010b0| 6c 74 69 46 69 6e 64 65 | 72 20 70 61 72 74 69 74 |ltiFinde|r partit|
|000010c0| 69 6f 6e 20 74 68 61 74 | 20 77 61 73 0d 09 20 6f |ion that| was.. o|
|000010d0| 75 72 20 72 65 71 75 65 | 73 74 65 64 20 6d 69 6e |ur reque|sted min|
|000010e0| 69 6d 75 6d 20 73 69 7a | 65 2c 20 61 73 20 67 69 |imum siz|e, as gi|
|000010f0| 76 65 6e 20 69 6e 20 74 | 68 65 20 27 53 49 5a 45 |ven in t|he 'SIZE|
|00001100| 27 20 72 65 73 6f 75 72 | 63 65 2e 7d 0d 09 20 0d |' resour|ce.}.. .|
|00001110| 09 6b 4d 69 6e 48 65 61 | 70 09 3d 20 32 31 20 2a |.kMinHea|p.= 21 *|
|00001120| 20 31 30 32 34 3b 0d 09 | 0d 09 7b 31 2e 30 31 20 | 1024;..|..{1.01 |
|00001130| 2d 20 6b 4d 69 6e 53 70 | 61 63 65 20 2d 20 54 68 |- kMinSp|ace - Th|
|00001140| 69 73 20 69 73 20 74 68 | 65 20 6d 69 6e 69 6d 75 |is is th|e minimu|
|00001150| 6d 20 72 65 73 75 6c 74 | 20 66 72 6f 6d 20 50 75 |m result| from Pu|
|00001160| 72 67 65 53 70 61 63 65 | 2c 20 77 68 65 6e 20 63 |rgeSpace|, when c|
|00001170| 61 6c 6c 65 64 0d 09 20 | 61 74 20 69 6e 69 74 69 |alled.. |at initi|
|00001180| 61 6c 69 7a 61 74 69 6f | 6e 20 74 69 6d 65 2c 20 |alizatio|n time, |
|00001190| 66 6f 72 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 |for the |applicat|
|000011a0| 69 6f 6e 20 74 6f 20 72 | 75 6e 2e 20 54 68 69 73 |ion to r|un. This|
|000011b0| 20 6e 75 6d 62 65 72 20 | 61 63 74 73 0d 09 20 61 | number |acts.. a|
|000011c0| 73 20 61 20 64 6f 75 62 | 6c 65 2d 63 68 65 63 6b |s a doub|le-check|
|000011d0| 20 74 6f 20 69 6e 73 75 | 72 65 20 74 68 61 74 20 | to insu|re that |
|000011e0| 74 68 65 72 65 20 72 65 | 61 6c 6c 79 20 69 73 20 |there re|ally is |
|000011f0| 65 6e 6f 75 67 68 20 6d | 65 6d 6f 72 79 20 66 6f |enough m|emory fo|
|00001200| 72 20 74 68 65 0d 09 20 | 61 70 70 6c 69 63 61 74 |r the.. |applicat|
|00001210| 69 6f 6e 20 74 6f 20 72 | 75 6e 2c 20 69 6e 63 6c |ion to r|un, incl|
|00001220| 75 64 69 6e 67 20 77 68 | 61 74 20 68 61 73 20 62 |uding wh|at has b|
|00001230| 65 65 6e 20 74 61 6b 65 | 6e 20 75 70 20 61 6c 72 |een take|n up alr|
|00001240| 65 61 64 79 20 62 79 0d | 09 20 70 72 65 2d 6c 6f |eady by.|. pre-lo|
|00001250| 61 64 65 64 20 72 65 73 | 6f 75 72 63 65 73 2c 20 |aded res|ources, |
|00001260| 74 68 65 20 73 63 72 61 | 70 2c 20 63 6f 64 65 2c |the scra|p, code,|
|00001270| 20 61 6e 64 20 6f 74 68 | 65 72 20 73 75 6e 64 72 | and oth|er sundr|
|00001280| 79 20 6d 65 6d 6f 72 79 | 20 62 6c 6f 63 6b 73 2e |y memory| blocks.|
|00001290| 7d 0d 09 20 0d 09 6b 4d | 69 6e 53 70 61 63 65 09 |}.. ..kM|inSpace.|
|000012a0| 3d 20 38 20 2a 20 31 30 | 32 34 3b 0d 09 0d 09 7b |= 8 * 10|24;....{|
|000012b0| 6b 45 78 74 72 65 6d 65 | 4e 65 67 20 61 6e 64 20 |kExtreme|Neg and |
|000012c0| 6b 45 78 74 72 65 6d 65 | 50 6f 73 20 61 72 65 20 |kExtreme|Pos are |
|000012d0| 75 73 65 64 20 74 6f 20 | 73 65 74 20 75 70 20 77 |used to |set up w|
|000012e0| 69 64 65 20 6f 70 65 6e | 20 72 65 63 74 61 6e 67 |ide open| rectang|
|000012f0| 6c 65 73 20 61 6e 64 20 | 72 65 67 69 6f 6e 73 2e |les and |regions.|
|00001300| 7d 0d 09 6b 45 78 74 72 | 65 6d 65 4e 65 67 09 3d |}..kExtr|emeNeg.=|
|00001310| 20 2d 33 32 37 36 38 3b | 0d 09 6b 45 78 74 72 65 | -32768;|..kExtre|
|00001320| 6d 65 50 6f 73 09 3d 20 | 33 32 37 36 37 20 2d 20 |mePos.= |32767 - |
|00001330| 31 3b 09 09 09 7b 72 65 | 71 75 69 72 65 64 20 66 |1;...{re|quired f|
|00001340| 6f 72 20 6f 6c 64 20 72 | 65 67 69 6f 6e 20 62 75 |or old r|egion bu|
|00001350| 67 7d 0d 09 0d 09 7b 54 | 68 65 20 66 6f 6c 6c 6f |g}....{T|he follo|
|00001360| 77 69 6e 67 20 63 6f 6e | 73 74 61 6e 74 73 20 61 |wing con|stants a|
|00001370| 72 65 20 61 6c 6c 20 72 | 65 73 6f 75 72 63 65 20 |re all r|esource |
|00001380| 49 44 73 2c 20 63 6f 72 | 72 65 73 70 6f 6e 64 69 |IDs, cor|respondi|
|00001390| 6e 67 20 74 6f 20 72 65 | 73 6f 75 72 63 65 73 20 |ng to re|sources |
|000013a0| 69 6e 20 53 61 6d 70 6c | 65 2e 72 2e 7d 0d 09 72 |in Sampl|e.r.}..r|
|000013b0| 4d 65 6e 75 42 61 72 09 | 3d 20 31 32 38 3b 09 09 |MenuBar.|= 128;..|
|000013c0| 09 09 09 7b 61 70 70 6c | 69 63 61 74 69 6f 6e 27 |...{appl|ication'|
|000013d0| 73 20 6d 65 6e 75 20 62 | 61 72 7d 0d 09 72 41 62 |s menu b|ar}..rAb|
|000013e0| 6f 75 74 41 6c 65 72 74 | 09 3d 20 31 32 38 3b 09 |outAlert|.= 128;.|
|000013f0| 09 09 09 09 7b 61 62 6f | 75 74 20 61 6c 65 72 74 |....{abo|ut alert|
|00001400| 7d 0d 09 72 55 73 65 72 | 41 6c 65 72 74 09 3d 20 |}..rUser|Alert.= |
|00001410| 31 32 39 3b 09 09 09 09 | 09 7b 65 72 72 6f 72 20 |129;....|.{error |
|00001420| 75 73 65 72 20 61 6c 65 | 72 74 7d 0d 09 72 57 69 |user ale|rt}..rWi|
|00001430| 6e 64 6f 77 09 09 3d 20 | 31 32 38 3b 09 09 09 09 |ndow..= |128;....|
|00001440| 09 7b 61 70 70 6c 69 63 | 61 74 69 6f 6e 27 73 20 |.{applic|ation's |
|00001450| 77 69 6e 64 6f 77 7d 0d | 09 72 53 74 6f 70 52 65 |window}.|.rStopRe|
|00001460| 63 74 09 3d 20 31 32 38 | 3b 09 09 09 09 09 7b 72 |ct.= 128|;.....{r|
|00001470| 65 63 74 61 6e 67 6c 65 | 20 66 6f 72 20 53 74 6f |ectangle| for Sto|
|00001480| 70 20 6c 69 67 68 74 7d | 0d 09 72 47 6f 52 65 63 |p light}|..rGoRec|
|00001490| 74 09 09 3d 20 31 32 39 | 3b 09 09 09 09 09 7b 72 |t..= 129|;.....{r|
|000014a0| 65 63 74 61 6e 67 6c 65 | 20 66 6f 72 20 47 6f 20 |ectangle| for Go |
|000014b0| 6c 69 67 68 74 7d 0d 0d | 09 7b 54 68 65 20 66 6f |light}..|.{The fo|
|000014c0| 6c 6c 6f 77 69 6e 67 20 | 63 6f 6e 73 74 61 6e 74 |llowing |constant|
|000014d0| 73 20 61 72 65 20 75 73 | 65 64 20 74 6f 20 69 64 |s are us|ed to id|
|000014e0| 65 6e 74 69 66 79 20 6d | 65 6e 75 73 20 61 6e 64 |entify m|enus and|
|000014f0| 20 74 68 65 69 72 20 69 | 74 65 6d 73 2e 20 54 68 | their i|tems. Th|
|00001500| 65 20 6d 65 6e 75 20 49 | 44 73 0d 09 20 68 61 76 |e menu I|Ds.. hav|
|00001510| 65 20 61 6e 20 22 6d 22 | 20 70 72 65 66 69 78 20 |e an "m"| prefix |
|00001520| 61 6e 64 20 74 68 65 20 | 69 74 65 6d 20 6e 75 6d |and the |item num|
|00001530| 62 65 72 73 20 77 69 74 | 68 69 6e 20 65 61 63 68 |bers wit|hin each|
|00001540| 20 6d 65 6e 75 20 68 61 | 76 65 20 61 6e 20 22 69 | menu ha|ve an "i|
|00001550| 22 20 70 72 65 66 69 78 | 2e 7d 0d 09 6d 41 70 70 |" prefix|.}..mApp|
|00001560| 6c 65 09 09 3d 20 31 32 | 38 3b 09 09 09 09 09 7b |le..= 12|8;.....{|
|00001570| 41 70 70 6c 65 20 6d 65 | 6e 75 7d 0d 09 69 41 62 |Apple me|nu}..iAb|
|00001580| 6f 75 74 09 09 3d 20 31 | 3b 0d 0d 09 6d 46 69 6c |out..= 1|;...mFil|
|00001590| 65 09 09 3d 20 31 32 39 | 3b 09 09 09 09 09 7b 46 |e..= 129|;.....{F|
|000015a0| 69 6c 65 20 6d 65 6e 75 | 7d 0d 09 69 4e 65 77 09 |ile menu|}..iNew.|
|000015b0| 09 3d 20 31 3b 0d 09 69 | 43 6c 6f 73 65 09 09 3d |.= 1;..i|Close..=|
|000015c0| 20 34 3b 0d 09 69 51 75 | 69 74 09 09 3d 20 31 32 | 4;..iQu|it..= 12|
|000015d0| 3b 0d 0d 09 6d 45 64 69 | 74 09 09 3d 20 31 33 30 |;...mEdi|t..= 130|
|000015e0| 3b 09 09 09 09 09 7b 45 | 64 69 74 20 6d 65 6e 75 |;.....{E|dit menu|
|000015f0| 7d 0d 09 69 55 6e 64 6f | 09 09 3d 20 31 3b 0d 09 |}..iUndo|..= 1;..|
|00001600| 69 43 75 74 09 09 3d 20 | 33 3b 0d 09 69 43 6f 70 |iCut..= |3;..iCop|
|00001610| 79 09 09 3d 20 34 3b 0d | 09 69 50 61 73 74 65 09 |y..= 4;.|.iPaste.|
|00001620| 09 3d 20 35 3b 0d 09 69 | 43 6c 65 61 72 09 09 3d |.= 5;..i|Clear..=|
|00001630| 20 36 3b 0d 0d 09 6d 4c | 69 67 68 74 09 09 3d 20 | 6;...mL|ight..= |
|00001640| 31 33 31 3b 09 09 09 09 | 09 7b 4c 69 67 68 74 20 |131;....|.{Light |
|00001650| 6d 65 6e 75 7d 0d 09 69 | 53 74 6f 70 09 09 3d 20 |menu}..i|Stop..= |
|00001660| 31 3b 0d 09 69 47 6f 09 | 09 09 3d 20 32 3b 0d 09 |1;..iGo.|..= 2;..|
|00001670| 0d 09 7b 31 2e 30 31 20 | 2d 20 6b 44 49 54 6f 70 |..{1.01 |- kDITop|
|00001680| 20 61 6e 64 20 6b 44 49 | 4c 65 66 74 20 61 72 65 | and kDI|Left are|
|00001690| 20 75 73 65 64 20 74 6f | 20 6c 6f 63 61 74 65 20 | used to| locate |
|000016a0| 74 68 65 20 44 69 73 6b | 20 49 6e 69 74 69 61 6c |the Disk| Initial|
|000016b0| 69 7a 61 74 69 6f 6e 20 | 64 69 61 6c 6f 67 73 2e |ization |dialogs.|
|000016c0| 7d 0d 09 6b 44 49 54 6f | 70 09 09 3d 20 24 30 30 |}..kDITo|p..= $00|
|000016d0| 35 30 3b 0d 09 6b 44 49 | 4c 65 66 74 09 09 3d 20 |50;..kDI|Left..= |
|000016e0| 24 30 30 37 30 3b 0d 0d | 0d 56 41 52 0d 09 7b 54 |$0070;..|.VAR..{T|
|000016f0| 68 65 20 22 67 22 20 70 | 72 65 66 69 78 20 69 73 |he "g" p|refix is|
|00001700| 20 75 73 65 64 20 74 6f | 20 65 6d 70 68 61 73 69 | used to| emphasi|
|00001710| 7a 65 20 74 68 61 74 20 | 61 20 76 61 72 69 61 62 |ze that |a variab|
|00001720| 6c 65 20 69 73 20 67 6c | 6f 62 61 6c 2e 7d 0d 0d |le is gl|obal.}..|
|00001730| 09 7b 47 4d 61 63 20 69 | 73 20 75 73 65 64 20 74 |.{GMac i|s used t|
|00001740| 6f 20 68 6f 6c 64 20 74 | 68 65 20 72 65 73 75 6c |o hold t|he resul|
|00001750| 74 20 6f 66 20 61 20 53 | 79 73 45 6e 76 69 72 6f |t of a S|ysEnviro|
|00001760| 6e 73 20 63 61 6c 6c 2e | 20 54 68 69 73 20 6d 61 |ns call.| This ma|
|00001770| 6b 65 73 0d 09 20 69 74 | 20 63 6f 6e 76 65 6e 69 |kes.. it| conveni|
|00001780| 65 6e 74 20 66 6f 72 20 | 61 6e 79 20 72 6f 75 74 |ent for |any rout|
|00001790| 69 6e 65 20 74 6f 20 63 | 68 65 63 6b 20 74 68 65 |ine to c|heck the|
|000017a0| 20 65 6e 76 69 72 6f 6e | 6d 65 6e 74 2e 20 49 74 | environ|ment. It|
|000017b0| 20 69 73 0d 09 20 67 6c | 6f 62 61 6c 20 69 6e 66 | is.. gl|obal inf|
|000017c0| 6f 72 6d 61 74 69 6f 6e | 2c 20 61 6e 79 77 61 79 |ormation|, anyway|
|000017d0| 2e 7d 0d 09 67 4d 61 63 | 09 09 09 09 3a 20 53 79 |.}..gMac|....: Sy|
|000017e0| 73 45 6e 76 52 65 63 3b | 09 7b 73 65 74 20 75 70 |sEnvRec;|.{set up|
|000017f0| 20 62 79 20 49 6e 69 74 | 69 61 6c 69 7a 65 7d 0d | by Init|ialize}.|
|00001800| 0d 09 7b 47 48 61 73 57 | 61 69 74 4e 65 78 74 45 |..{GHasW|aitNextE|
|00001810| 76 65 6e 74 20 69 73 20 | 73 65 74 20 61 74 20 73 |vent is |set at s|
|00001820| 74 61 72 74 75 70 2c 20 | 61 6e 64 20 74 65 6c 6c |tartup, |and tell|
|00001830| 73 20 77 68 65 74 68 65 | 72 20 74 68 65 20 57 61 |s whethe|r the Wa|
|00001840| 69 74 4e 65 78 74 45 76 | 65 6e 74 0d 09 20 74 72 |itNextEv|ent.. tr|
|00001850| 61 70 20 69 73 20 61 76 | 61 69 6c 61 62 6c 65 2e |ap is av|ailable.|
|00001860| 20 49 66 20 69 74 20 69 | 73 20 66 61 6c 73 65 2c | If it i|s false,|
|00001870| 20 77 65 20 6b 6e 6f 77 | 20 74 68 61 74 20 77 65 | we know| that we|
|00001880| 20 6d 75 73 74 20 63 61 | 6c 6c 20 47 65 74 4e 65 | must ca|ll GetNe|
|00001890| 78 74 45 76 65 6e 74 2e | 7d 0d 09 67 48 61 73 57 |xtEvent.|}..gHasW|
|000018a0| 61 69 74 4e 65 78 74 45 | 76 65 6e 74 09 3a 20 42 |aitNextE|vent.: B|
|000018b0| 4f 4f 4c 45 41 4e 3b 09 | 09 7b 73 65 74 20 75 70 |OOLEAN;.|.{set up|
|000018c0| 20 62 79 20 49 6e 69 74 | 69 61 6c 69 7a 65 7d 0d | by Init|ialize}.|
|000018d0| 0d 09 7b 47 49 6e 42 61 | 63 6b 67 72 6f 75 6e 64 |..{GInBa|ckground|
|000018e0| 20 69 73 20 6d 61 69 6e | 74 61 69 6e 65 64 20 62 | is main|tained b|
|000018f0| 79 20 6f 75 72 20 6f 73 | 45 76 65 6e 74 20 68 61 |y our os|Event ha|
|00001900| 6e 64 6c 69 6e 67 20 72 | 6f 75 74 69 6e 65 73 2e |ndling r|outines.|
|00001910| 20 41 6e 79 20 70 61 72 | 74 20 6f 66 0d 09 20 74 | Any par|t of.. t|
|00001920| 68 65 20 70 72 6f 67 72 | 61 6d 20 63 61 6e 20 63 |he progr|am can c|
|00001930| 68 65 63 6b 20 69 74 20 | 74 6f 20 66 69 6e 64 20 |heck it |to find |
|00001940| 6f 75 74 20 69 66 20 69 | 74 20 69 73 20 63 75 72 |out if i|t is cur|
|00001950| 72 65 6e 74 6c 79 20 69 | 6e 20 74 68 65 20 62 61 |rently i|n the ba|
|00001960| 63 6b 67 72 6f 75 6e 64 | 2e 7d 0d 09 67 49 6e 42 |ckground|.}..gInB|
|00001970| 61 63 6b 67 72 6f 75 6e | 64 09 09 3a 20 42 4f 4f |ackgroun|d..: BOO|
|00001980| 4c 45 41 4e 3b 09 09 7b | 6d 61 69 6e 74 61 69 6e |LEAN;..{|maintain|
|00001990| 65 64 20 62 79 20 49 6e | 69 74 69 61 6c 69 7a 65 |ed by In|itialize|
|000019a0| 20 61 6e 64 20 44 6f 45 | 76 65 6e 74 7d 0d 0d 0d | and DoE|vent}...|
|000019b0| 09 7b 54 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |.{The fo|llowing |
|000019c0| 67 6c 6f 62 61 6c 73 20 | 61 72 65 20 74 68 65 20 |globals |are the |
|000019d0| 73 74 61 74 65 20 6f 66 | 20 74 68 65 20 77 69 6e |state of| the win|
|000019e0| 64 6f 77 2e 20 49 66 20 | 77 65 20 73 75 70 70 6f |dow. If |we suppo|
|000019f0| 72 74 65 64 20 6d 6f 72 | 65 20 74 68 61 6e 0d 09 |rted mor|e than..|
|00001a00| 20 6f 6e 65 20 77 69 6e | 64 6f 77 2c 20 74 68 65 | one win|dow, the|
|00001a10| 79 20 77 6f 75 6c 64 20 | 62 65 20 61 74 74 61 74 |y would |be attat|
|00001a20| 63 68 65 64 20 74 6f 20 | 65 61 63 68 20 64 6f 63 |ched to |each doc|
|00001a30| 75 6d 65 6e 74 2c 20 72 | 61 74 68 65 72 20 74 68 |ument, r|ather th|
|00001a40| 61 6e 20 67 6c 6f 62 61 | 6c 73 2e 7d 0d 0d 09 7b |an globa|ls.}...{|
|00001a50| 47 53 74 6f 70 70 65 64 | 20 74 65 6c 6c 73 20 77 |GStopped| tells w|
|00001a60| 68 65 74 68 65 72 20 74 | 68 65 20 73 74 6f 70 20 |hether t|he stop |
|00001a70| 6c 69 67 68 74 20 69 73 | 20 63 75 72 72 65 6e 74 |light is| current|
|00001a80| 6c 79 20 6f 6e 20 73 74 | 6f 70 20 6f 72 20 67 6f |ly on st|op or go|
|00001a90| 2e 7d 0d 09 67 53 74 6f | 70 70 65 64 09 09 09 3a |.}..gSto|pped...:|
|00001aa0| 20 42 4f 4f 4c 45 41 4e | 3b 09 09 7b 6d 61 69 6e | BOOLEAN|;..{main|
|00001ab0| 74 61 69 6e 65 64 20 62 | 79 20 49 6e 69 74 69 61 |tained b|y Initia|
|00001ac0| 6c 69 7a 65 20 61 6e 64 | 20 53 65 74 4c 69 67 68 |lize and| SetLigh|
|00001ad0| 74 7d 0d 0d 09 7b 47 53 | 74 6f 70 52 65 63 74 20 |t}...{GS|topRect |
|00001ae0| 61 6e 64 20 67 47 6f 52 | 65 63 74 20 61 72 65 20 |and gGoR|ect are |
|00001af0| 74 68 65 20 72 65 63 74 | 61 6e 67 6c 65 73 20 6f |the rect|angles o|
|00001b00| 66 20 74 68 65 20 74 77 | 6f 20 73 74 6f 70 20 6c |f the tw|o stop l|
|00001b10| 69 67 68 74 73 20 69 6e | 20 74 68 65 20 77 69 6e |ights in| the win|
|00001b20| 64 6f 77 2e 7d 0d 09 67 | 53 74 6f 70 52 65 63 74 |dow.}..g|StopRect|
|00001b30| 09 09 09 3a 20 52 65 63 | 74 3b 09 09 09 7b 73 65 |...: Rec|t;...{se|
|00001b40| 74 20 75 70 20 62 79 20 | 49 6e 69 74 69 61 6c 69 |t up by |Initiali|
|00001b50| 7a 65 7d 0d 09 67 47 6f | 52 65 63 74 09 09 09 09 |ze}..gGo|Rect....|
|00001b60| 3a 20 52 65 63 74 3b 09 | 09 09 7b 73 65 74 20 75 |: Rect;.|..{set u|
|00001b70| 70 20 62 79 20 49 6e 69 | 74 69 61 6c 69 7a 65 7d |p by Ini|tialize}|
|00001b80| 0d 0d 0d 7b 24 53 20 49 | 6e 69 74 69 61 6c 69 7a |...{$S I|nitializ|
|00001b90| 65 7d 0d 46 55 4e 43 54 | 49 4f 4e 20 54 72 61 70 |e}.FUNCT|ION Trap|
|00001ba0| 41 76 61 69 6c 61 62 6c | 65 28 74 4e 75 6d 62 65 |Availabl|e(tNumbe|
|00001bb0| 72 3a 20 49 4e 54 45 47 | 45 52 3b 20 74 54 79 70 |r: INTEG|ER; tTyp|
|00001bc0| 65 3a 20 54 72 61 70 54 | 79 70 65 29 3a 20 42 4f |e: TrapT|ype): BO|
|00001bd0| 4f 4c 45 41 4e 3b 0d 0d | 7b 43 68 65 63 6b 20 74 |OLEAN;..|{Check t|
|00001be0| 6f 20 73 65 65 20 69 66 | 20 61 20 67 69 76 65 6e |o see if| a given|
|00001bf0| 20 74 72 61 70 20 69 73 | 20 69 6d 70 6c 65 6d 65 | trap is| impleme|
|00001c00| 6e 74 65 64 2e 20 54 68 | 69 73 20 69 73 20 6f 6e |nted. Th|is is on|
|00001c10| 6c 79 20 75 73 65 64 20 | 62 79 20 74 68 65 0d 20 |ly used |by the. |
|00001c20| 49 6e 69 74 69 61 6c 69 | 7a 65 20 72 6f 75 74 69 |Initiali|ze routi|
|00001c30| 6e 65 20 69 6e 20 74 68 | 69 73 20 70 72 6f 67 72 |ne in th|is progr|
|00001c40| 61 6d 2c 20 73 6f 20 77 | 65 20 70 75 74 20 69 74 |am, so w|e put it|
|00001c50| 20 69 6e 20 74 68 65 20 | 49 6e 69 74 69 61 6c 69 | in the |Initiali|
|00001c60| 7a 65 20 73 65 67 6d 65 | 6e 74 2e 0d 20 54 68 65 |ze segme|nt.. The|
|00001c70| 20 72 65 63 6f 6d 6d 65 | 6e 64 65 64 20 61 70 70 | recomme|nded app|
|00001c80| 72 6f 61 63 68 20 74 6f | 20 73 65 65 20 69 66 20 |roach to| see if |
|00001c90| 61 20 74 72 61 70 20 69 | 73 20 69 6d 70 6c 65 6d |a trap i|s implem|
|00001ca0| 65 6e 74 65 64 20 69 73 | 20 74 6f 20 73 65 65 20 |ented is| to see |
|00001cb0| 69 66 0d 20 74 68 65 20 | 61 64 64 72 65 73 73 20 |if. the |address |
|00001cc0| 6f 66 20 74 68 65 20 74 | 72 61 70 20 72 6f 75 74 |of the t|rap rout|
|00001cd0| 69 6e 65 20 69 73 20 74 | 68 65 20 73 61 6d 65 20 |ine is t|he same |
|00001ce0| 61 73 20 74 68 65 20 61 | 64 64 72 65 73 73 20 6f |as the a|ddress o|
|00001cf0| 66 20 74 68 65 0d 20 55 | 6e 69 6d 70 6c 65 6d 65 |f the. U|nimpleme|
|00001d00| 6e 74 65 64 20 74 72 61 | 70 2e 7d 0d 7b 31 2e 30 |nted tra|p.}.{1.0|
|00001d10| 32 20 2d 20 4e 65 65 64 | 73 20 74 6f 20 62 65 20 |2 - Need|s to be |
|00001d20| 63 61 6c 6c 65 64 20 61 | 66 74 65 72 20 63 61 6c |called a|fter cal|
|00001d30| 6c 20 74 6f 20 53 79 73 | 45 6e 76 69 72 6f 6e 73 |l to Sys|Environs|
|00001d40| 20 73 6f 20 74 68 61 74 | 20 69 74 20 63 61 6e 20 | so that| it can |
|00001d50| 63 68 65 63 6b 0d 20 69 | 66 20 61 20 54 6f 6f 6c |check. i|f a Tool|
|00001d60| 54 72 61 70 20 69 73 20 | 6f 75 74 20 6f 66 20 72 |Trap is |out of r|
|00001d70| 61 6e 67 65 20 6f 66 20 | 61 20 70 72 65 2d 4d 61 |ange of |a pre-Ma|
|00001d80| 63 49 49 20 52 4f 4d 2e | 7d 0d 0d 42 45 47 49 4e |cII ROM.|}..BEGIN|
|00001d90| 0d 09 49 46 20 28 74 54 | 79 70 65 20 3d 20 54 6f |..IF (tT|ype = To|
|00001da0| 6f 6c 54 72 61 70 29 20 | 26 0d 09 09 28 67 4d 61 |olTrap) |&...(gMa|
|00001db0| 63 2e 6d 61 63 68 69 6e | 65 54 79 70 65 20 3e 20 |c.machin|eType > |
|00001dc0| 65 6e 76 4d 61 63 68 55 | 6e 6b 6e 6f 77 6e 29 20 |envMachU|nknown) |
|00001dd0| 26 0d 09 09 28 67 4d 61 | 63 2e 6d 61 63 68 69 6e |&...(gMa|c.machin|
|00001de0| 65 54 79 70 65 20 3c 20 | 65 6e 76 4d 61 63 49 49 |eType < |envMacII|
|00001df0| 29 20 54 48 45 4e 20 42 | 45 47 49 4e 09 09 7b 69 |) THEN B|EGIN..{i|
|00001e00| 74 27 73 20 61 20 35 31 | 32 4b 45 2c 20 50 6c 75 |t's a 51|2KE, Plu|
|00001e10| 73 2c 20 6f 72 20 53 45 | 7d 0d 09 09 74 4e 75 6d |s, or SE|}...tNum|
|00001e20| 62 65 72 20 3a 3d 20 42 | 41 4e 44 28 74 4e 75 6d |ber := B|AND(tNum|
|00001e30| 62 65 72 2c 20 24 30 33 | 46 46 29 3b 0d 09 09 49 |ber, $03|FF);...I|
|00001e40| 46 20 74 4e 75 6d 62 65 | 72 20 3e 20 24 30 31 46 |F tNumbe|r > $01F|
|00001e50| 46 20 54 48 45 4e 09 09 | 09 09 09 09 09 7b 77 68 |F THEN..|.....{wh|
|00001e60| 69 63 68 20 6d 65 61 6e | 73 20 74 68 65 20 74 6f |ich mean|s the to|
|00001e70| 6f 6c 20 74 72 61 70 73 | 7d 0d 09 09 09 74 4e 75 |ol traps|}....tNu|
|00001e80| 6d 62 65 72 20 3a 3d 20 | 5f 55 6e 69 6d 70 6c 65 |mber := |_Unimple|
|00001e90| 6d 65 6e 74 65 64 3b 09 | 09 09 09 09 7b 6f 6e 6c |mented;.|....{onl|
|00001ea0| 79 20 67 6f 20 74 6f 20 | 24 30 31 46 46 7d 0d 09 |y go to |$01FF}..|
|00001eb0| 45 4e 44 3b 0d 09 54 72 | 61 70 41 76 61 69 6c 61 |END;..Tr|apAvaila|
|00001ec0| 62 6c 65 20 3a 3d 20 4e | 47 65 74 54 72 61 70 41 |ble := N|GetTrapA|
|00001ed0| 64 64 72 65 73 73 28 74 | 4e 75 6d 62 65 72 2c 20 |ddress(t|Number, |
|00001ee0| 74 54 79 70 65 29 20 3c | 3e 0d 09 09 09 09 09 09 |tType) <|>.......|
|00001ef0| 47 65 74 54 72 61 70 41 | 64 64 72 65 73 73 28 5f |GetTrapA|ddress(_|
|00001f00| 55 6e 69 6d 70 6c 65 6d | 65 6e 74 65 64 29 3b 0d |Unimplem|ented);.|
|00001f10| 45 4e 44 3b 20 7b 54 72 | 61 70 41 76 61 69 6c 61 |END; {Tr|apAvaila|
|00001f20| 62 6c 65 7d 0d 0d 0d 7b | 24 53 20 4d 61 69 6e 7d |ble}...{|$S Main}|
|00001f30| 0d 46 55 4e 43 54 49 4f | 4e 20 49 73 44 41 57 69 |.FUNCTIO|N IsDAWi|
|00001f40| 6e 64 6f 77 28 77 69 6e | 64 6f 77 3a 20 57 69 6e |ndow(win|dow: Win|
|00001f50| 64 6f 77 50 74 72 29 3a | 20 42 4f 4f 4c 45 41 4e |dowPtr):| BOOLEAN|
|00001f60| 3b 0d 0d 7b 43 68 65 63 | 6b 20 69 66 20 61 20 77 |;..{Chec|k if a w|
|00001f70| 69 6e 64 6f 77 20 62 65 | 6c 6f 6e 67 73 20 74 6f |indow be|longs to|
|00001f80| 20 61 20 64 65 73 6b 20 | 61 63 63 65 73 73 6f 72 | a desk |accessor|
|00001f90| 79 2e 7d 0d 0d 42 45 47 | 49 4e 0d 09 49 46 20 77 |y.}..BEG|IN..IF w|
|00001fa0| 69 6e 64 6f 77 20 3d 20 | 4e 49 4c 20 54 48 45 4e |indow = |NIL THEN|
|00001fb0| 0d 09 09 49 73 44 41 57 | 69 6e 64 6f 77 20 3a 3d |...IsDAW|indow :=|
|00001fc0| 20 46 41 4c 53 45 0d 09 | 45 4c 53 45 09 7b 44 41 | FALSE..|ELSE.{DA|
|00001fd0| 20 77 69 6e 64 6f 77 73 | 20 68 61 76 65 20 6e 65 | windows| have ne|
|00001fe0| 67 61 74 69 76 65 20 77 | 69 6e 64 6f 77 4b 69 6e |gative w|indowKin|
|00001ff0| 64 73 7d 0d 09 09 49 73 | 44 41 57 69 6e 64 6f 77 |ds}...Is|DAWindow|
|00002000| 20 3a 3d 20 57 69 6e 64 | 6f 77 50 65 65 6b 28 77 | := Wind|owPeek(w|
|00002010| 69 6e 64 6f 77 29 5e 2e | 77 69 6e 64 6f 77 4b 69 |indow)^.|windowKi|
|00002020| 6e 64 20 3c 20 30 3b 0d | 45 4e 44 3b 20 7b 49 73 |nd < 0;.|END; {Is|
|00002030| 44 41 57 69 6e 64 6f 77 | 7d 0d 0d 0d 7b 24 53 20 |DAWindow|}...{$S |
|00002040| 4d 61 69 6e 7d 0d 46 55 | 4e 43 54 49 4f 4e 20 49 |Main}.FU|NCTION I|
|00002050| 73 41 70 70 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |sAppWind|ow(windo|
|00002060| 77 3a 20 57 69 6e 64 6f | 77 50 74 72 29 3a 20 42 |w: Windo|wPtr): B|
|00002070| 4f 4f 4c 45 41 4e 3b 0d | 0d 7b 43 68 65 63 6b 20 |OOLEAN;.|.{Check |
|00002080| 74 6f 20 73 65 65 20 69 | 66 20 61 20 77 69 6e 64 |to see i|f a wind|
|00002090| 6f 77 20 62 65 6c 6f 6e | 67 73 20 74 6f 20 74 68 |ow belon|gs to th|
|000020a0| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 2e 20 49 |e applic|ation. I|
|000020b0| 66 20 74 68 65 20 77 69 | 6e 64 6f 77 20 70 6f 69 |f the wi|ndow poi|
|000020c0| 6e 74 65 72 0d 20 70 61 | 73 73 65 64 20 77 61 73 |nter. pa|ssed was|
|000020d0| 20 4e 49 4c 2c 20 74 68 | 65 6e 20 69 74 20 63 6f | NIL, th|en it co|
|000020e0| 75 6c 64 20 6e 6f 74 20 | 62 65 20 61 6e 20 61 70 |uld not |be an ap|
|000020f0| 70 6c 69 63 61 74 69 6f | 6e 20 77 69 6e 64 6f 77 |plicatio|n window|
|00002100| 2e 20 57 69 6e 64 6f 77 | 4b 69 6e 64 73 0d 20 74 |. Window|Kinds. t|
|00002110| 68 61 74 20 61 72 65 20 | 6e 65 67 61 74 69 76 65 |hat are |negative|
|00002120| 20 62 65 6c 6f 6e 67 20 | 74 6f 20 74 68 65 20 73 | belong |to the s|
|00002130| 79 73 74 65 6d 20 61 6e | 64 20 77 69 6e 64 6f 77 |ystem an|d window|
|00002140| 4b 69 6e 64 73 20 6c 65 | 73 73 20 74 68 61 6e 20 |Kinds le|ss than |
|00002150| 75 73 65 72 4b 69 6e 64 | 0d 20 61 72 65 20 72 65 |userKind|. are re|
|00002160| 73 65 72 76 65 64 20 62 | 79 20 41 70 70 6c 65 20 |served b|y Apple |
|00002170| 65 78 63 65 70 74 20 66 | 6f 72 20 77 69 6e 64 6f |except f|or windo|
|00002180| 77 4b 69 6e 64 73 20 65 | 71 75 61 6c 20 74 6f 20 |wKinds e|qual to |
|00002190| 64 69 61 6c 6f 67 4b 69 | 6e 64 2c 20 77 68 69 63 |dialogKi|nd, whic|
|000021a0| 68 0d 20 6d 65 61 6e 20 | 69 74 20 69 73 20 61 20 |h. mean |it is a |
|000021b0| 64 69 61 6c 6f 67 2e 0d | 20 31 2e 30 32 20 2d 20 |dialog..| 1.02 - |
|000021c0| 49 6e 20 6f 72 64 65 72 | 20 74 6f 20 72 65 64 75 |In order| to redu|
|000021d0| 63 65 20 74 68 65 20 63 | 68 61 6e 63 65 20 6f 66 |ce the c|hance of|
|000021e0| 20 61 63 63 69 64 65 6e | 74 61 6c 6c 79 20 74 72 | acciden|tally tr|
|000021f0| 65 61 74 69 6e 67 20 73 | 6f 6d 65 20 77 69 6e 64 |eating s|ome wind|
|00002200| 6f 77 0d 20 61 73 20 61 | 6e 20 41 70 70 57 69 6e |ow. as a|n AppWin|
|00002210| 64 6f 77 20 74 68 61 74 | 20 73 68 6f 75 6c 64 6e |dow that| shouldn|
|00002220| 27 74 20 62 65 2c 20 77 | 65 27 6c 6c 20 6f 6e 6c |'t be, w|e'll onl|
|00002230| 79 20 72 65 74 75 72 6e | 20 74 72 75 65 20 69 66 |y return| true if|
|00002240| 20 74 68 65 20 77 69 6e | 64 6f 77 6b 69 6e 64 0d | the win|dowkind.|
|00002250| 20 69 73 20 75 73 65 72 | 4b 69 6e 64 2e 20 49 66 | is user|Kind. If|
|00002260| 20 79 6f 75 20 61 64 64 | 20 64 69 66 66 65 72 65 | you add| differe|
|00002270| 6e 74 20 6b 69 6e 64 73 | 20 6f 66 20 77 69 6e 64 |nt kinds| of wind|
|00002280| 6f 77 73 20 74 6f 20 53 | 61 6d 70 6c 65 20 79 6f |ows to S|ample yo|
|00002290| 75 27 6c 6c 20 6e 65 65 | 64 0d 20 74 6f 20 63 68 |u'll nee|d. to ch|
|000022a0| 61 6e 67 65 20 68 6f 77 | 20 74 68 69 73 20 61 6c |ange how| this al|
|000022b0| 6c 20 77 6f 72 6b 73 2e | 7d 0d 0d 42 45 47 49 4e |l works.|}..BEGIN|
|000022c0| 0d 09 49 46 20 77 69 6e | 64 6f 77 20 3d 20 4e 49 |..IF win|dow = NI|
|000022d0| 4c 20 54 48 45 4e 0d 09 | 09 49 73 41 70 70 57 69 |L THEN..|.IsAppWi|
|000022e0| 6e 64 6f 77 20 3a 3d 20 | 46 41 4c 53 45 0d 09 45 |ndow := |FALSE..E|
|000022f0| 4c 53 45 09 7b 61 70 70 | 6c 69 63 61 74 69 6f 6e |LSE.{app|lication|
|00002300| 20 77 69 6e 64 6f 77 73 | 20 68 61 76 65 20 77 69 | windows| have wi|
|00002310| 6e 64 6f 77 4b 69 6e 64 | 73 20 3d 20 75 73 65 72 |ndowKind|s = user|
|00002320| 4b 69 6e 64 20 28 38 29 | 7d 0d 09 09 57 49 54 48 |Kind (8)|}...WITH|
|00002330| 20 57 69 6e 64 6f 77 50 | 65 65 6b 28 77 69 6e 64 | WindowP|eek(wind|
|00002340| 6f 77 29 5e 20 44 4f 0d | 09 09 09 49 73 41 70 70 |ow)^ DO.|...IsApp|
|00002350| 57 69 6e 64 6f 77 20 3a | 3d 20 28 77 69 6e 64 6f |Window :|= (windo|
|00002360| 77 4b 69 6e 64 20 3d 20 | 75 73 65 72 4b 69 6e 64 |wKind = |userKind|
|00002370| 29 3b 0d 45 4e 44 3b 20 | 7b 49 73 41 70 70 57 69 |);.END; |{IsAppWi|
|00002380| 6e 64 6f 77 7d 0d 0d 0d | 7b 24 53 20 4d 61 69 6e |ndow}...|{$S Main|
|00002390| 7d 0d 50 52 4f 43 45 44 | 55 52 45 20 41 6c 65 72 |}.PROCED|URE Aler|
|000023a0| 74 55 73 65 72 3b 0d 0d | 7b 44 69 73 70 6c 61 79 |tUser;..|{Display|
|000023b0| 20 61 6e 20 61 6c 65 72 | 74 20 74 68 61 74 20 74 | an aler|t that t|
|000023c0| 65 6c 6c 73 20 74 68 65 | 20 75 73 65 72 20 61 6e |ells the| user an|
|000023d0| 20 65 72 72 6f 72 20 6f | 63 63 75 72 72 65 64 2c | error o|ccurred,|
|000023e0| 20 74 68 65 6e 20 65 78 | 69 74 20 74 68 65 20 70 | then ex|it the p|
|000023f0| 72 6f 67 72 61 6d 2e 0d | 20 54 68 69 73 20 72 6f |rogram..| This ro|
|00002400| 75 74 69 6e 65 20 69 73 | 20 75 73 65 64 20 61 73 |utine is| used as|
|00002410| 20 61 6e 20 75 6c 74 69 | 6d 61 74 65 20 62 61 69 | an ulti|mate bai|
|00002420| 6c 2d 6f 75 74 20 66 6f | 72 20 73 65 72 69 6f 75 |l-out fo|r seriou|
|00002430| 73 20 65 72 72 6f 72 73 | 20 74 68 61 74 20 70 72 |s errors| that pr|
|00002440| 6f 68 69 62 69 74 0d 20 | 74 68 65 20 63 6f 6e 74 |ohibit. |the cont|
|00002450| 69 6e 75 61 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |inuation| of the |
|00002460| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2e 20 45 72 72 |applicat|ion. Err|
|00002470| 6f 72 73 20 74 68 61 74 | 20 64 6f 20 6e 6f 74 20 |ors that| do not |
|00002480| 72 65 71 75 69 72 65 20 | 74 68 65 20 74 65 72 6d |require |the term|
|00002490| 69 6e 61 74 69 6f 6e 0d | 20 6f 66 20 74 68 65 20 |ination.| of the |
|000024a0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 73 68 6f 75 |applicat|ion shou|
|000024b0| 6c 64 20 62 65 20 68 61 | 6e 64 6c 65 64 20 69 6e |ld be ha|ndled in|
|000024c0| 20 61 20 64 69 66 66 65 | 72 65 6e 74 20 6d 61 6e | a diffe|rent man|
|000024d0| 6e 65 72 2e 20 45 72 72 | 6f 72 20 63 68 65 63 6b |ner. Err|or check|
|000024e0| 69 6e 67 20 61 6e 64 0d | 20 72 65 70 6f 72 74 69 |ing and.| reporti|
|000024f0| 6e 67 20 68 61 73 20 61 | 20 70 6c 61 63 65 20 65 |ng has a| place e|
|00002500| 76 65 6e 20 69 6e 20 74 | 68 65 20 73 69 6d 70 6c |ven in t|he simpl|
|00002510| 65 73 74 20 61 70 70 6c | 69 63 61 74 69 6f 6e 2e |est appl|ication.|
|00002520| 20 46 6f 72 20 73 69 6d | 70 6c 69 63 69 74 79 2c | For sim|plicity,|
|00002530| 20 74 68 65 20 61 6c 65 | 72 74 0d 20 64 69 73 70 | the ale|rt. disp|
|00002540| 6c 61 79 65 64 20 68 65 | 72 65 20 6f 6e 6c 79 20 |layed he|re only |
|00002550| 73 61 79 73 20 74 68 61 | 74 20 61 6e 20 65 72 72 |says tha|t an err|
|00002560| 6f 72 20 6f 63 63 75 72 | 72 65 64 2c 20 62 75 74 |or occur|red, but|
|00002570| 20 6e 6f 74 20 77 68 61 | 74 20 69 74 20 77 61 73 | not wha|t it was|
|00002580| 2e 20 54 68 65 72 65 20 | 61 72 65 0d 20 76 61 72 |. There |are. var|
|00002590| 69 6f 75 73 20 6d 65 74 | 68 6f 64 73 20 61 76 61 |ious met|hods ava|
|000025a0| 69 6c 61 62 6c 65 20 66 | 6f 72 20 62 65 69 6e 67 |ilable f|or being|
|000025b0| 20 6d 6f 72 65 20 73 70 | 65 63 69 66 69 63 2e 7d | more sp|ecific.}|
|000025c0| 0d 20 0d 56 41 52 0d 09 | 69 74 65 6d 48 69 74 09 |. .VAR..|itemHit.|
|000025d0| 3a 20 49 4e 54 45 47 45 | 52 3b 0d 42 45 47 49 4e |: INTEGE|R;.BEGIN|
|000025e0| 0d 09 53 65 74 43 75 72 | 73 6f 72 28 61 72 72 6f |..SetCur|sor(arro|
|000025f0| 77 29 3b 0d 09 69 74 65 | 6d 48 69 74 20 3a 3d 20 |w);..ite|mHit := |
|00002600| 41 6c 65 72 74 28 72 55 | 73 65 72 41 6c 65 72 74 |Alert(rU|serAlert|
|00002610| 2c 20 4e 49 4c 29 3b 0d | 09 45 78 69 74 54 6f 53 |, NIL);.|.ExitToS|
|00002620| 68 65 6c 6c 3b 0d 45 4e | 44 3b 20 7b 41 6c 65 72 |hell;.EN|D; {Aler|
|00002630| 74 55 73 65 72 7d 0d 0d | 0d 7b 24 53 20 4d 61 69 |tUser}..|.{$S Mai|
|00002640| 6e 7d 0d 46 55 4e 43 54 | 49 4f 4e 20 44 6f 43 6c |n}.FUNCT|ION DoCl|
|00002650| 6f 73 65 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |oseWindo|w(window|
|00002660| 3a 20 57 69 6e 64 6f 77 | 50 74 72 29 20 3a 20 42 |: Window|Ptr) : B|
|00002670| 4f 4f 4c 45 41 4e 3b 0d | 0d 7b 43 6c 6f 73 65 20 |OOLEAN;.|.{Close |
|00002680| 61 20 77 69 6e 64 6f 77 | 2e 7d 0d 0d 7b 31 2e 30 |a window|.}..{1.0|
|00002690| 31 20 2d 20 41 74 20 74 | 68 69 73 20 70 6f 69 6e |1 - At t|his poin|
|000026a0| 74 2c 20 69 66 20 74 68 | 65 72 65 20 77 61 73 20 |t, if th|ere was |
|000026b0| 61 20 64 6f 63 75 6d 65 | 6e 74 20 61 73 73 6f 63 |a docume|nt assoc|
|000026c0| 69 61 74 65 64 20 77 69 | 74 68 20 61 0d 20 77 69 |iated wi|th a. wi|
|000026d0| 6e 64 6f 77 2c 20 79 6f | 75 20 63 6f 75 6c 64 20 |ndow, yo|u could |
|000026e0| 64 6f 20 61 6e 79 20 64 | 6f 63 75 6d 65 6e 74 20 |do any d|ocument |
|000026f0| 73 61 76 69 6e 67 20 70 | 72 6f 63 65 73 73 69 6e |saving p|rocessin|
|00002700| 67 20 69 66 20 69 74 20 | 69 73 20 27 64 69 72 74 |g if it |is 'dirt|
|00002710| 79 27 2e 0d 20 44 6f 43 | 6c 6f 73 65 57 69 6e 64 |y'.. DoC|loseWind|
|00002720| 6f 77 20 77 6f 75 6c 64 | 20 72 65 74 75 72 6e 20 |ow would| return |
|00002730| 54 52 55 45 20 69 66 20 | 74 68 65 20 77 69 6e 64 |TRUE if |the wind|
|00002740| 6f 77 20 61 63 74 75 61 | 6c 6c 79 20 63 6c 6f 73 |ow actua|lly clos|
|00002750| 65 73 2c 20 69 2e 65 2e | 2c 0d 20 74 68 65 20 75 |es, i.e.|,. the u|
|00002760| 73 65 72 20 64 6f 65 73 | 20 6e 6f 74 20 63 61 6e |ser does| not can|
|00002770| 63 65 6c 20 66 72 6f 6d | 20 61 20 73 61 76 65 20 |cel from| a save |
|00002780| 64 69 61 6c 6f 67 2e 20 | 54 68 69 73 20 72 65 73 |dialog. |This res|
|00002790| 75 6c 74 20 69 73 20 68 | 61 6e 64 79 20 77 68 65 |ult is h|andy whe|
|000027a0| 6e 0d 20 74 68 65 20 75 | 73 65 72 20 71 75 69 74 |n. the u|ser quit|
|000027b0| 73 20 61 6e 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |s an app|lication|
|000027c0| 2c 20 62 75 74 20 74 68 | 65 6e 20 63 61 6e 63 65 |, but th|en cance|
|000027d0| 6c 73 20 61 20 73 61 76 | 65 20 6f 66 20 61 20 64 |ls a sav|e of a d|
|000027e0| 6f 63 75 6d 65 6e 74 0d | 20 61 73 73 6f 63 69 61 |ocument.| associa|
|000027f0| 74 65 64 20 77 69 74 68 | 20 61 20 77 69 6e 64 6f |ted with| a windo|
|00002800| 77 2e 20 57 65 20 61 6c | 73 6f 20 61 64 64 65 64 |w. We al|so added|
|00002810| 20 63 6f 64 65 20 74 6f | 20 63 6c 6f 73 65 20 74 | code to| close t|
|00002820| 68 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 0d 20 |he appli|cation. |
|00002830| 77 69 6e 64 6f 77 20 73 | 69 6e 63 65 20 6f 74 68 |window s|ince oth|
|00002840| 65 72 77 69 73 65 2c 20 | 74 68 65 20 74 65 72 6d |erwise, |the term|
|00002850| 69 6e 61 74 69 6f 6e 20 | 72 6f 75 74 69 6e 65 73 |ination |routines|
|00002860| 20 77 6f 75 6c 64 20 6e | 65 76 65 72 20 73 74 6f | would n|ever sto|
|00002870| 70 20 6c 6f 6f 70 69 6e | 67 2c 0d 20 77 61 69 74 |p loopin|g,. wait|
|00002880| 69 6e 67 20 66 6f 72 20 | 46 72 6f 6e 74 57 69 6e |ing for |FrontWin|
|00002890| 64 6f 77 20 74 6f 20 72 | 65 74 75 72 6e 20 4e 49 |dow to r|eturn NI|
|000028a0| 4c 2e 7d 0d 0d 42 45 47 | 49 4e 0d 09 44 6f 43 6c |L.}..BEG|IN..DoCl|
|000028b0| 6f 73 65 57 69 6e 64 6f | 77 20 3a 3d 20 54 52 55 |oseWindo|w := TRU|
|000028c0| 45 3b 0d 09 49 46 20 49 | 73 44 41 57 69 6e 64 6f |E;..IF I|sDAWindo|
|000028d0| 77 28 77 69 6e 64 6f 77 | 29 20 54 48 45 4e 0d 09 |w(window|) THEN..|
|000028e0| 09 43 6c 6f 73 65 44 65 | 73 6b 41 63 63 28 57 69 |.CloseDe|skAcc(Wi|
|000028f0| 6e 64 6f 77 50 65 65 6b | 28 77 69 6e 64 6f 77 29 |ndowPeek|(window)|
|00002900| 5e 2e 77 69 6e 64 6f 77 | 4b 69 6e 64 29 3b 0d 09 |^.window|Kind);..|
|00002910| 49 46 20 49 73 41 70 70 | 57 69 6e 64 6f 77 28 77 |IF IsApp|Window(w|
|00002920| 69 6e 64 6f 77 29 20 54 | 48 45 4e 0d 09 09 43 6c |indow) T|HEN...Cl|
|00002930| 6f 73 65 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |oseWindo|w(window|
|00002940| 29 3b 0d 45 4e 44 3b 20 | 7b 44 6f 43 6c 6f 73 65 |);.END; |{DoClose|
|00002950| 57 69 6e 64 6f 77 7d 0d | 0d 0d 7b 24 53 20 49 6e |Window}.|..{$S In|
|00002960| 69 74 69 61 6c 69 7a 65 | 7d 0d 46 55 4e 43 54 49 |itialize|}.FUNCTI|
|00002970| 4f 4e 20 47 6f 47 65 74 | 52 65 63 74 28 72 65 63 |ON GoGet|Rect(rec|
|00002980| 74 49 44 3a 20 49 4e 54 | 45 47 45 52 3b 20 56 41 |tID: INT|EGER; VA|
|00002990| 52 20 74 68 65 52 65 63 | 74 3a 20 52 65 63 74 29 |R theRec|t: Rect)|
|000029a0| 20 3a 20 42 4f 4f 4c 45 | 41 4e 3b 0d 20 0d 7b 54 | : BOOLE|AN;. .{T|
|000029b0| 68 69 73 20 75 74 69 6c | 69 74 79 20 6c 6f 61 64 |his util|ity load|
|000029c0| 73 20 74 68 65 20 67 6c | 6f 62 61 6c 20 72 65 63 |s the gl|obal rec|
|000029d0| 74 61 6e 67 6c 65 73 20 | 74 68 61 74 20 61 72 65 |tangles |that are|
|000029e0| 20 75 73 65 64 20 62 79 | 20 74 68 65 20 77 69 6e | used by| the win|
|000029f0| 64 6f 77 0d 20 64 72 61 | 77 69 6e 67 20 72 6f 75 |dow. dra|wing rou|
|00002a00| 74 69 6e 65 73 2e 20 49 | 74 20 73 68 6f 77 73 20 |tines. I|t shows |
|00002a10| 68 6f 77 20 74 68 65 20 | 72 65 73 6f 75 72 63 65 |how the |resource|
|00002a20| 20 6d 61 6e 61 67 65 72 | 20 63 61 6e 20 62 65 20 | manager| can be |
|00002a30| 75 73 65 64 20 74 6f 20 | 68 6f 6c 64 0d 20 76 61 |used to |hold. va|
|00002a40| 6c 75 65 73 20 69 6e 20 | 61 20 63 6f 6e 76 65 6e |lues in |a conven|
|00002a50| 69 65 6e 74 20 6d 61 6e | 6e 65 72 2e 20 54 68 65 |ient man|ner. The|
|00002a60| 73 65 20 76 61 6c 75 65 | 73 20 61 72 65 20 74 68 |se value|s are th|
|00002a70| 65 6e 20 65 61 73 69 6c | 79 20 61 6c 74 65 72 65 |en easil|y altere|
|00002a80| 64 20 77 69 74 68 6f 75 | 74 0d 20 68 61 76 69 6e |d withou|t. havin|
|00002a90| 67 20 74 6f 20 72 65 2d | 63 6f 6d 70 69 6c 65 20 |g to re-|compile |
|00002aa0| 74 68 65 20 73 6f 75 72 | 63 65 20 63 6f 64 65 2e |the sour|ce code.|
|00002ab0| 20 49 6e 20 74 68 69 73 | 20 70 61 72 74 69 63 75 | In this| particu|
|00002ac0| 6c 61 72 20 63 61 73 65 | 2c 20 77 65 20 6b 6e 6f |lar case|, we kno|
|00002ad0| 77 0d 20 74 68 61 74 20 | 74 68 69 73 20 72 6f 75 |w. that |this rou|
|00002ae0| 74 69 6e 65 20 69 73 20 | 62 65 69 6e 67 20 63 61 |tine is |being ca|
|00002af0| 6c 6c 65 64 20 61 74 20 | 69 6e 69 74 69 61 6c 69 |lled at |initiali|
|00002b00| 7a 61 74 69 6f 6e 20 74 | 69 6d 65 2e 20 54 68 65 |zation t|ime. The|
|00002b10| 72 65 66 6f 72 65 2c 0d | 20 69 66 20 74 68 69 73 |refore,.| if this|
|00002b20| 20 72 65 74 75 72 6e 73 | 20 46 41 4c 53 45 2c 20 | returns| FALSE, |
|00002b30| 77 65 20 77 69 6c 6c 20 | 61 73 73 75 6d 65 20 74 |we will |assume t|
|00002b40| 68 61 74 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 |hat the |applicat|
|00002b50| 69 6f 6e 20 69 73 20 69 | 6e 20 73 75 63 68 0d 20 |ion is i|n such. |
|00002b60| 62 61 64 20 73 68 61 70 | 65 20 74 68 61 74 20 77 |bad shap|e that w|
|00002b70| 65 20 73 68 6f 75 6c 64 | 20 6a 75 73 74 20 65 78 |e should| just ex|
|00002b80| 69 74 2e 20 59 6f 75 72 | 20 65 72 72 6f 72 20 68 |it. Your| error h|
|00002b90| 61 6e 64 6c 69 6e 67 20 | 6d 61 79 20 64 69 66 66 |andling |may diff|
|00002ba0| 65 72 2c 20 62 75 74 0d | 20 74 68 65 20 63 68 65 |er, but.| the che|
|00002bb0| 63 6b 20 73 68 6f 75 6c | 64 20 73 74 69 6c 6c 20 |ck shoul|d still |
|00002bc0| 62 65 20 6d 61 64 65 2e | 7d 0d 0d 7b 31 2e 30 31 |be made.|}..{1.01|
|00002bd0| 20 2d 20 43 68 61 6e 67 | 65 64 20 47 6f 47 65 74 | - Chang|ed GoGet|
|00002be0| 52 65 63 74 20 74 6f 20 | 72 65 74 75 72 6e 20 61 |Rect to |return a|
|00002bf0| 20 42 4f 4f 4c 45 41 4e | 20 74 68 61 74 20 69 6e | BOOLEAN| that in|
|00002c00| 64 69 63 61 74 65 73 20 | 69 66 20 69 74 20 77 61 |dicates |if it wa|
|00002c10| 73 20 73 75 63 63 65 73 | 73 66 75 6c 0d 20 69 6e |s succes|sful. in|
|00002c20| 20 67 65 74 74 69 6e 67 | 20 74 68 65 20 72 65 63 | getting| the rec|
|00002c30| 74 61 6e 67 6c 65 20 72 | 61 74 68 65 72 20 74 68 |tangle r|ather th|
|00002c40| 61 6e 20 6a 75 73 74 20 | 64 6f 69 6e 67 20 45 78 |an just |doing Ex|
|00002c50| 69 74 54 6f 53 68 65 6c | 6c 2e 7d 0d 20 0d 54 59 |itToShel|l.}. .TY|
|00002c60| 50 45 0d 09 52 65 63 74 | 50 74 72 09 09 3d 20 5e |PE..Rect|Ptr..= ^|
|00002c70| 52 65 63 74 3b 0d 09 52 | 65 63 74 48 6e 64 09 09 |Rect;..R|ectHnd..|
|00002c80| 3d 20 5e 52 65 63 74 50 | 74 72 3b 0d 56 41 52 0d |= ^RectP|tr;.VAR.|
|00002c90| 09 72 65 73 6f 75 72 63 | 65 09 3a 20 48 61 6e 64 |.resourc|e.: Hand|
|00002ca0| 6c 65 3b 0d 42 45 47 49 | 4e 0d 09 72 65 73 6f 75 |le;.BEGI|N..resou|
|00002cb0| 72 63 65 20 3a 3d 20 47 | 65 74 52 65 73 6f 75 72 |rce := G|etResour|
|00002cc0| 63 65 28 27 52 45 43 54 | 27 2c 20 72 65 63 74 49 |ce('RECT|', rectI|
|00002cd0| 44 29 3b 0d 09 49 46 20 | 72 65 73 6f 75 72 63 65 |D);..IF |resource|
|00002ce0| 20 3c 3e 20 4e 49 4c 20 | 54 48 45 4e 20 42 45 47 | <> NIL |THEN BEG|
|00002cf0| 49 4e 0d 09 09 47 6f 47 | 65 74 52 65 63 74 20 3a |IN...GoG|etRect :|
|00002d00| 3d 20 54 52 55 45 3b 0d | 09 09 74 68 65 52 65 63 |= TRUE;.|..theRec|
|00002d10| 74 20 3a 3d 20 52 65 63 | 74 48 6e 64 28 72 65 73 |t := Rec|tHnd(res|
|00002d20| 6f 75 72 63 65 29 5e 5e | 3b 0d 09 09 45 4e 44 0d |ource)^^|;...END.|
|00002d30| 09 45 4c 53 45 0d 09 09 | 47 6f 47 65 74 52 65 63 |.ELSE...|GoGetRec|
|00002d40| 74 20 3a 3d 20 46 41 4c | 53 45 3b 0d 45 4e 44 3b |t := FAL|SE;.END;|
|00002d50| 20 7b 47 6f 47 65 74 52 | 65 63 74 7d 0d 0d 0d 7b | {GoGetR|ect}...{|
|00002d60| 24 53 20 49 6e 69 74 69 | 61 6c 69 7a 65 7d 0d 50 |$S Initi|alize}.P|
|00002d70| 52 4f 43 45 44 55 52 45 | 20 49 6e 69 74 69 61 6c |ROCEDURE| Initial|
|00002d80| 69 7a 65 3b 0d 0d 7b 53 | 65 74 20 75 70 20 74 68 |ize;..{S|et up th|
|00002d90| 65 20 77 68 6f 6c 65 20 | 77 6f 72 6c 64 2c 20 69 |e whole |world, i|
|00002da0| 6e 63 6c 75 64 69 6e 67 | 20 67 6c 6f 62 61 6c 20 |ncluding| global |
|00002db0| 76 61 72 69 61 62 6c 65 | 73 2c 20 54 6f 6f 6c 62 |variable|s, Toolb|
|00002dc0| 6f 78 20 6d 61 6e 61 67 | 65 72 73 2c 0d 20 61 6e |ox manag|ers,. an|
|00002dd0| 64 20 6d 65 6e 75 73 2e | 20 57 65 20 61 6c 73 6f |d menus.| We also|
|00002de0| 20 63 72 65 61 74 65 20 | 6f 75 72 20 6f 6e 65 20 | create |our one |
|00002df0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 77 69 6e 64 |applicat|ion wind|
|00002e00| 6f 77 20 61 74 20 74 68 | 69 73 20 74 69 6d 65 2e |ow at th|is time.|
|00002e10| 0d 20 53 69 6e 63 65 20 | 77 69 6e 64 6f 77 20 73 |. Since |window s|
|00002e20| 74 6f 72 61 67 65 20 69 | 73 20 6e 6f 6e 2d 72 65 |torage i|s non-re|
|00002e30| 6c 6f 63 61 74 65 61 62 | 6c 65 2c 20 68 6f 77 20 |locateab|le, how |
|00002e40| 61 6e 64 20 77 68 65 6e | 20 74 6f 20 61 6c 6c 6f |and when| to allo|
|00002e50| 63 61 74 65 20 73 70 61 | 63 65 0d 20 66 6f 72 20 |cate spa|ce. for |
|00002e60| 77 69 6e 64 6f 77 73 20 | 69 73 20 76 65 72 79 20 |windows |is very |
|00002e70| 69 6d 70 6f 72 74 61 6e | 74 20 73 6f 20 74 68 61 |importan|t so tha|
|00002e80| 74 20 68 65 61 70 20 66 | 72 61 67 6d 65 6e 74 61 |t heap f|ragmenta|
|00002e90| 74 69 6f 6e 20 64 6f 65 | 73 20 6e 6f 74 20 6f 63 |tion doe|s not oc|
|00002ea0| 63 75 72 2e 0d 20 42 65 | 63 61 75 73 65 20 53 61 |cur.. Be|cause Sa|
|00002eb0| 6d 70 6c 65 20 68 61 73 | 20 6f 6e 6c 79 20 6f 6e |mple has| only on|
|00002ec0| 65 20 77 69 6e 64 6f 77 | 20 61 6e 64 20 69 74 20 |e window| and it |
|00002ed0| 69 73 20 6f 6e 6c 79 20 | 64 69 73 70 6f 73 65 64 |is only |disposed|
|00002ee0| 20 77 68 65 6e 20 74 68 | 65 20 61 70 70 6c 69 63 | when th|e applic|
|00002ef0| 61 74 69 6f 6e 0d 20 71 | 75 69 74 73 2c 20 77 65 |ation. q|uits, we|
|00002f00| 20 77 69 6c 6c 20 61 6c | 6c 6f 63 61 74 65 20 69 | will al|locate i|
|00002f10| 74 73 20 73 70 61 63 65 | 20 68 65 72 65 2c 20 62 |ts space| here, b|
|00002f20| 65 66 6f 72 65 20 61 6e | 79 74 68 69 6e 67 20 74 |efore an|ything t|
|00002f30| 68 61 74 20 6d 69 67 68 | 74 20 62 65 20 61 20 6c |hat migh|t be a l|
|00002f40| 6f 63 6b 65 64 0d 20 72 | 65 6c 6f 63 61 74 61 62 |ocked. r|elocatab|
|00002f50| 6c 65 20 6f 62 6a 65 63 | 74 20 67 65 74 73 20 69 |le objec|t gets i|
|00002f60| 6e 74 6f 20 74 68 65 20 | 68 65 61 70 2e 20 54 68 |nto the |heap. Th|
|00002f70| 69 73 20 77 61 79 2c 20 | 77 65 20 63 61 6e 20 66 |is way, |we can f|
|00002f80| 6f 72 63 65 20 69 74 73 | 20 73 74 6f 72 61 67 65 |orce its| storage|
|00002f90| 20 74 6f 20 62 65 0d 20 | 69 6e 20 74 68 65 20 6c | to be. |in the l|
|00002fa0| 6f 77 65 73 74 20 6d 65 | 6d 6f 72 79 20 61 76 61 |owest me|mory ava|
|00002fb0| 69 6c 61 62 6c 65 20 69 | 6e 20 74 68 65 20 68 65 |ilable i|n the he|
|00002fc0| 61 70 2e 20 57 69 6e 64 | 6f 77 20 73 74 6f 72 61 |ap. Wind|ow stora|
|00002fd0| 67 65 20 63 61 6e 20 64 | 69 66 66 65 72 20 77 69 |ge can d|iffer wi|
|00002fe0| 64 65 6c 79 0d 20 61 6d | 6f 6e 67 73 74 20 61 70 |dely. am|ongst ap|
|00002ff0| 70 6c 69 63 61 74 69 6f | 6e 73 20 64 65 70 65 6e |plicatio|ns depen|
|00003000| 64 69 6e 67 20 6f 6e 20 | 68 6f 77 20 6d 61 6e 79 |ding on |how many|
|00003010| 20 77 69 6e 64 6f 77 73 | 20 61 72 65 20 63 72 65 | windows| are cre|
|00003020| 61 74 65 64 20 61 6e 64 | 20 64 69 73 70 6f 73 65 |ated and| dispose|
|00003030| 64 2e 0d 20 49 66 20 61 | 20 66 61 69 6c 75 72 65 |d.. If a| failure|
|00003040| 20 6f 63 63 75 72 73 20 | 68 65 72 65 2c 20 77 65 | occurs |here, we|
|00003050| 20 77 69 6c 6c 20 63 6f | 6e 73 69 64 65 72 20 74 | will co|nsider t|
|00003060| 68 61 74 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 |hat the |applicat|
|00003070| 69 6f 6e 20 69 73 20 69 | 6e 20 73 75 63 68 0d 20 |ion is i|n such. |
|00003080| 62 61 64 20 73 68 61 70 | 65 20 74 68 61 74 20 77 |bad shap|e that w|
|00003090| 65 20 73 68 6f 75 6c 64 | 20 6a 75 73 74 20 65 78 |e should| just ex|
|000030a0| 69 74 2e 20 59 6f 75 72 | 20 65 72 72 6f 72 20 68 |it. Your| error h|
|000030b0| 61 6e 64 6c 69 6e 67 20 | 6d 61 79 20 64 69 66 66 |andling |may diff|
|000030c0| 65 72 2c 20 62 75 74 0d | 20 74 68 65 20 63 68 65 |er, but.| the che|
|000030d0| 63 6b 73 20 73 68 6f 75 | 6c 64 20 73 74 69 6c 6c |cks shou|ld still|
|000030e0| 20 62 65 20 6d 61 64 65 | 2e 7d 0d 20 0d 7b 31 2e | be made|.}. .{1.|
|000030f0| 30 31 20 2d 20 54 68 65 | 20 63 6f 64 65 20 74 68 |01 - The| code th|
|00003100| 61 74 20 75 73 65 64 20 | 74 6f 20 62 65 20 70 61 |at used |to be pa|
|00003110| 72 74 20 6f 66 20 46 6f | 72 63 65 45 6e 76 69 72 |rt of Fo|rceEnvir|
|00003120| 6f 6e 73 20 68 61 73 20 | 62 65 65 6e 20 6d 6f 76 |ons has |been mov|
|00003130| 65 64 20 69 6e 74 6f 0d | 20 74 68 69 73 20 6d 6f |ed into.| this mo|
|00003140| 64 75 6c 65 2e 20 49 66 | 20 61 6e 20 65 72 72 6f |dule. If| an erro|
|00003150| 72 20 69 73 20 64 65 74 | 65 63 74 65 64 2c 20 69 |r is det|ected, i|
|00003160| 6e 73 74 65 61 64 20 6f | 66 20 6d 65 72 65 6c 79 |nstead o|f merely|
|00003170| 20 64 6f 69 6e 67 20 61 | 6e 20 45 78 69 74 54 6f | doing a|n ExitTo|
|00003180| 53 68 65 6c 6c 2c 0d 20 | 77 68 69 63 68 20 6c 65 |Shell,. |which le|
|00003190| 61 76 65 73 20 74 68 65 | 20 75 73 65 72 20 77 69 |aves the| user wi|
|000031a0| 74 68 6f 75 74 20 6d 75 | 63 68 20 74 6f 20 67 6f |thout mu|ch to go|
|000031b0| 20 6f 6e 2c 20 77 65 20 | 63 61 6c 6c 20 41 6c 65 | on, we |call Ale|
|000031c0| 72 74 55 73 65 72 2c 20 | 77 68 69 63 68 20 70 75 |rtUser, |which pu|
|000031d0| 74 73 0d 20 75 70 20 61 | 20 73 69 6d 70 6c 65 20 |ts. up a| simple |
|000031e0| 61 6c 65 72 74 20 74 68 | 61 74 20 6a 75 73 74 20 |alert th|at just |
|000031f0| 73 61 79 73 20 61 6e 20 | 65 72 72 6f 72 20 6f 63 |says an |error oc|
|00003200| 63 75 72 72 65 64 20 61 | 6e 64 20 74 68 65 6e 20 |curred a|nd then |
|00003210| 63 61 6c 6c 73 20 45 78 | 69 74 54 6f 53 68 65 6c |calls Ex|itToShel|
|00003220| 6c 2e 0d 20 49 6e 20 74 | 68 65 20 69 6e 74 65 72 |l.. In t|he inter|
|00003230| 65 73 74 73 20 6f 66 20 | 6b 65 65 70 69 6e 67 20 |ests of |keeping |
|00003240| 74 68 69 6e 67 73 20 73 | 69 6d 70 6c 65 2c 20 74 |things s|imple, t|
|00003250| 68 65 20 61 6c 65 72 74 | 20 64 6f 65 73 20 6e 6f |he alert| does no|
|00003260| 74 20 73 74 61 74 65 20 | 74 68 65 20 73 70 65 63 |t state |the spec|
|00003270| 69 66 69 63 0d 20 63 61 | 75 73 65 20 6f 66 20 74 |ific. ca|use of t|
|00003280| 68 65 20 65 72 72 6f 72 | 2c 20 62 75 74 20 61 20 |he error|, but a |
|00003290| 6d 6f 72 65 20 69 6e 66 | 6f 72 6d 61 74 69 76 65 |more inf|ormative|
|000032a0| 20 61 6c 65 72 74 20 77 | 6f 75 6c 64 20 62 65 20 | alert w|ould be |
|000032b0| 61 70 70 72 6f 70 72 69 | 61 74 65 20 66 6f 72 20 |appropri|ate for |
|000032c0| 6d 6f 72 65 0d 20 73 6f | 70 68 69 73 74 69 63 61 |more. so|phistica|
|000032d0| 74 65 64 20 61 70 70 6c | 69 63 61 74 69 6f 6e 73 |ted appl|ications|
|000032e0| 2e 20 53 69 6e 63 65 20 | 74 68 65 72 65 20 69 73 |. Since |there is|
|000032f0| 20 6e 6f 20 6f 74 68 65 | 72 20 63 6c 65 61 6e 75 | no othe|r cleanu|
|00003300| 70 20 6e 65 65 64 65 64 | 20 61 74 20 74 68 69 73 |p needed| at this|
|00003310| 20 70 6f 69 6e 74 0d 20 | 69 66 20 61 6e 20 65 72 | point. |if an er|
|00003320| 72 6f 72 20 69 73 20 64 | 65 74 65 63 74 65 64 2c |ror is d|etected,|
|00003330| 20 74 68 69 73 20 66 6f | 72 6d 20 6f 66 20 65 72 | this fo|rm of er|
|00003340| 72 6f 72 2d 20 68 61 6e | 64 6c 69 6e 67 20 69 73 |ror- han|dling is|
|00003350| 20 61 63 63 65 70 74 61 | 62 6c 65 2e 20 49 66 20 | accepta|ble. If |
|00003360| 6d 6f 72 65 0d 20 73 6f | 70 68 69 73 74 69 63 61 |more. so|phistica|
|00003370| 74 65 64 20 65 72 72 6f | 72 20 72 65 63 6f 76 65 |ted erro|r recove|
|00003380| 72 79 20 69 73 20 6e 65 | 65 64 65 64 2c 20 61 20 |ry is ne|eded, a |
|00003390| 73 69 67 6e 61 6c 20 6d | 65 63 68 61 6e 69 73 6d |signal m|echanism|
|000033a0| 2c 20 73 75 63 68 20 61 | 73 20 69 73 20 70 72 6f |, such a|s is pro|
|000033b0| 76 69 64 65 64 0d 20 62 | 79 20 53 69 67 6e 61 6c |vided. b|y Signal|
|000033c0| 73 2c 20 63 61 6e 20 62 | 65 20 75 73 65 64 2e 7d |s, can b|e used.}|
|000033d0| 0d 0d 56 41 52 0d 09 6d | 65 6e 75 42 61 72 09 09 |..VAR..m|enuBar..|
|000033e0| 09 3a 20 48 61 6e 64 6c | 65 3b 0d 09 77 69 6e 64 |.: Handl|e;..wind|
|000033f0| 6f 77 09 09 09 3a 20 57 | 69 6e 64 6f 77 50 74 72 |ow...: W|indowPtr|
|00003400| 3b 0d 09 69 67 6e 6f 72 | 65 45 72 72 6f 72 09 09 |;..ignor|eError..|
|00003410| 3a 20 4f 53 45 72 72 3b | 0d 09 74 6f 74 61 6c 2c |: OSErr;|..total,|
|00003420| 20 63 6f 6e 74 69 67 09 | 3a 20 4c 6f 6e 67 49 6e | contig.|: LongIn|
|00003430| 74 3b 0d 09 69 67 6e 6f | 72 65 52 65 73 75 6c 74 |t;..igno|reResult|
|00003440| 09 3a 20 42 4f 4f 4c 45 | 41 4e 3b 0d 09 65 76 65 |.: BOOLE|AN;..eve|
|00003450| 6e 74 09 09 09 3a 20 45 | 76 65 6e 74 52 65 63 6f |nt...: E|ventReco|
|00003460| 72 64 3b 0d 09 63 6f 75 | 6e 74 09 09 09 3a 20 49 |rd;..cou|nt...: I|
|00003470| 4e 54 45 47 45 52 3b 0d | 0d 42 45 47 49 4e 0d 09 |NTEGER;.|.BEGIN..|
|00003480| 67 49 6e 42 61 63 6b 67 | 72 6f 75 6e 64 20 3a 3d |gInBackg|round :=|
|00003490| 20 46 41 4c 53 45 3b 0d | 0d 09 49 6e 69 74 47 72 | FALSE;.|..InitGr|
|000034a0| 61 66 28 40 74 68 65 50 | 6f 72 74 29 3b 0d 09 49 |af(@theP|ort);..I|
|000034b0| 6e 69 74 46 6f 6e 74 73 | 3b 0d 09 49 6e 69 74 57 |nitFonts|;..InitW|
|000034c0| 69 6e 64 6f 77 73 3b 0d | 09 49 6e 69 74 4d 65 6e |indows;.|.InitMen|
|000034d0| 75 73 3b 0d 09 54 45 49 | 6e 69 74 3b 0d 09 49 6e |us;..TEI|nit;..In|
|000034e0| 69 74 44 69 61 6c 6f 67 | 73 28 4e 49 4c 29 3b 0d |itDialog|s(NIL);.|
|000034f0| 09 49 6e 69 74 43 75 72 | 73 6f 72 3b 0d 09 0d 09 |.InitCur|sor;....|
|00003500| 7b 43 61 6c 6c 20 4d 50 | 50 4f 70 65 6e 20 61 6e |{Call MP|POpen an|
|00003510| 64 20 41 54 50 4c 6f 61 | 64 20 61 74 20 74 68 69 |d ATPLoa|d at thi|
|00003520| 73 20 70 6f 69 6e 74 20 | 74 6f 20 69 6e 69 74 69 |s point |to initi|
|00003530| 61 6c 69 7a 65 20 41 70 | 70 6c 65 54 61 6c 6b 2c |alize Ap|pleTalk,|
|00003540| 0d 09 20 69 66 20 79 6f | 75 20 61 72 65 20 75 73 |.. if yo|u are us|
|00003550| 69 6e 67 20 69 74 2e 7d | 0d 09 7b 4e 4f 54 45 20 |ing it.}|..{NOTE |
|00003560| 2d 2d 20 49 74 20 69 73 | 20 6e 6f 20 6c 6f 6e 67 |-- It is| no long|
|00003570| 65 72 20 6e 65 63 65 73 | 73 61 72 79 2c 20 61 6e |er neces|sary, an|
|00003580| 64 20 61 63 74 75 61 6c | 6c 79 20 75 6e 68 65 61 |d actual|ly unhea|
|00003590| 6c 74 68 79 2c 20 74 6f | 20 63 68 65 63 6b 0d 09 |lthy, to| check..|
|000035a0| 20 50 6f 72 74 42 55 73 | 65 20 61 6e 64 20 53 50 | PortBUs|e and SP|
|000035b0| 43 6f 6e 66 69 67 20 62 | 65 66 6f 72 65 20 6f 70 |Config b|efore op|
|000035c0| 65 6e 69 6e 67 20 41 70 | 70 6c 65 54 61 6c 6b 2e |ening Ap|pleTalk.|
|000035d0| 20 54 68 65 20 64 72 69 | 76 65 72 73 20 61 72 65 | The dri|vers are|
|000035e0| 20 63 61 70 61 62 6c 65 | 0d 09 20 6f 66 20 63 68 | capable|.. of ch|
|000035f0| 65 63 6b 69 6e 67 20 66 | 6f 72 20 70 6f 72 74 20 |ecking f|or port |
|00003600| 61 76 61 69 6c 61 62 69 | 6c 69 74 79 20 74 68 65 |availabi|lity the|
|00003610| 6d 73 65 6c 76 65 73 2e | 7d 0d 09 0d 09 7b 54 68 |mselves.|}....{Th|
|00003620| 69 73 20 6e 65 78 74 20 | 62 69 74 20 6f 66 20 63 |is next |bit of c|
|00003630| 6f 64 65 20 69 73 20 6e | 65 63 65 73 73 61 72 79 |ode is n|ecessary|
|00003640| 20 74 6f 20 61 6c 6c 6f | 77 20 74 68 65 20 64 65 | to allo|w the de|
|00003650| 66 61 75 6c 74 20 62 75 | 74 74 6f 6e 20 6f 66 20 |fault bu|tton of |
|00003660| 6f 75 72 0d 09 20 61 6c | 65 72 74 20 62 65 20 6f |our.. al|ert be o|
|00003670| 75 74 6c 69 6e 65 64 2e | 0d 09 20 31 2e 30 32 20 |utlined.|.. 1.02 |
|00003680| 2d 20 43 68 61 6e 67 65 | 64 20 74 6f 20 63 61 6c |- Change|d to cal|
|00003690| 6c 20 45 76 65 6e 74 41 | 76 61 69 6c 20 73 6f 20 |l EventA|vail so |
|000036a0| 74 68 61 74 20 77 65 20 | 64 6f 6e 27 74 20 6c 6f |that we |don't lo|
|000036b0| 73 65 20 73 6f 6d 65 20 | 69 6d 70 6f 72 74 61 6e |se some |importan|
|000036c0| 74 0d 09 20 65 76 65 6e | 74 73 2e 7d 0d 09 20 0d |t.. even|ts.}.. .|
|000036d0| 09 46 4f 52 20 63 6f 75 | 6e 74 20 3a 3d 20 31 20 |.FOR cou|nt := 1 |
|000036e0| 54 4f 20 33 20 44 4f 0d | 09 09 69 67 6e 6f 72 65 |TO 3 DO.|..ignore|
|000036f0| 52 65 73 75 6c 74 20 3a | 3d 20 45 76 65 6e 74 41 |Result :|= EventA|
|00003700| 76 61 69 6c 28 65 76 65 | 72 79 45 76 65 6e 74 2c |vail(eve|ryEvent,|
|00003710| 20 65 76 65 6e 74 29 3b | 0d 09 0d 09 7b 49 67 6e | event);|....{Ign|
|00003720| 6f 72 65 20 74 68 65 20 | 65 72 72 6f 72 20 72 65 |ore the |error re|
|00003730| 74 75 72 6e 65 64 20 66 | 72 6f 6d 20 53 79 73 45 |turned f|rom SysE|
|00003740| 6e 76 69 72 6f 6e 73 3b | 20 65 76 65 6e 20 69 66 |nvirons;| even if|
|00003750| 20 61 6e 20 65 72 72 6f | 72 20 6f 63 63 75 72 72 | an erro|r occurr|
|00003760| 65 64 2c 0d 09 20 74 68 | 65 20 53 79 73 45 6e 76 |ed,.. th|e SysEnv|
|00003770| 69 72 6f 6e 73 20 67 6c | 75 65 20 77 69 6c 6c 20 |irons gl|ue will |
|00003780| 66 69 6c 6c 20 69 6e 20 | 74 68 65 20 53 79 73 45 |fill in |the SysE|
|00003790| 6e 76 52 65 63 2e 20 59 | 6f 75 20 63 61 6e 20 73 |nvRec. Y|ou can s|
|000037a0| 61 76 65 20 61 20 72 65 | 64 75 6e 64 61 6e 74 0d |ave a re|dundant.|
|000037b0| 09 20 63 61 6c 6c 20 74 | 6f 20 53 79 73 45 6e 76 |. call t|o SysEnv|
|000037c0| 69 72 6f 6e 73 20 62 79 | 20 63 61 6c 6c 69 6e 67 |irons by| calling|
|000037d0| 20 69 74 20 61 66 74 65 | 72 20 69 6e 69 74 69 61 | it afte|r initia|
|000037e0| 6c 69 7a 69 6e 67 20 41 | 70 70 6c 65 54 61 6c 6b |lizing A|ppleTalk|
|000037f0| 2e 7d 0d 09 20 0d 09 69 | 67 6e 6f 72 65 45 72 72 |.}.. ..i|gnoreErr|
|00003800| 6f 72 20 3a 3d 20 53 79 | 73 45 6e 76 69 72 6f 6e |or := Sy|sEnviron|
|00003810| 73 28 6b 53 79 73 45 6e | 76 69 72 6f 6e 73 56 65 |s(kSysEn|vironsVe|
|00003820| 72 73 69 6f 6e 2c 20 67 | 4d 61 63 29 3b 0d 09 0d |rsion, g|Mac);...|
|00003830| 09 7b 4d 61 6b 65 20 73 | 75 72 65 20 74 68 61 74 |.{Make s|ure that|
|00003840| 20 74 68 65 20 6d 61 63 | 68 69 6e 65 20 68 61 73 | the mac|hine has|
|00003850| 20 61 74 20 6c 65 61 73 | 74 20 31 32 38 4b 20 52 | at leas|t 128K R|
|00003860| 4f 4d 73 2e 20 49 66 20 | 69 74 20 64 6f 65 73 6e |OMs. If |it doesn|
|00003870| 27 74 2c 20 65 78 69 74 | 2e 7d 0d 09 0d 09 49 46 |'t, exit|.}....IF|
|00003880| 20 67 4d 61 63 2e 6d 61 | 63 68 69 6e 65 54 79 70 | gMac.ma|chineTyp|
|00003890| 65 20 3c 20 30 20 54 48 | 45 4e 20 41 6c 65 72 74 |e < 0 TH|EN Alert|
|000038a0| 55 73 65 72 3b 0d 09 0d | 09 7b 31 2e 30 32 20 2d |User;...|.{1.02 -|
|000038b0| 20 4d 6f 76 65 20 54 72 | 61 70 41 76 61 69 6c 61 | Move Tr|apAvaila|
|000038c0| 62 6c 65 20 63 61 6c 6c | 20 74 6f 20 61 66 74 65 |ble call| to afte|
|000038d0| 72 20 53 79 73 45 6e 76 | 69 72 6f 6e 73 20 73 6f |r SysEnv|irons so|
|000038e0| 20 74 68 61 74 20 77 65 | 20 63 61 6e 20 74 65 6c | that we| can tel|
|000038f0| 6c 0d 09 20 69 6e 20 54 | 72 61 70 41 76 61 69 6c |l.. in T|rapAvail|
|00003900| 61 62 6c 65 20 69 66 20 | 61 20 74 6f 6f 6c 20 74 |able if |a tool t|
|00003910| 72 61 70 20 76 61 6c 75 | 65 20 69 73 20 6f 75 74 |rap valu|e is out|
|00003920| 20 6f 66 20 72 61 6e 67 | 65 2e 7d 0d 09 20 0d 09 | of rang|e.}.. ..|
|00003930| 67 48 61 73 57 61 69 74 | 4e 65 78 74 45 76 65 6e |gHasWait|NextEven|
|00003940| 74 20 3a 3d 20 54 72 61 | 70 41 76 61 69 6c 61 62 |t := Tra|pAvailab|
|00003950| 6c 65 28 5f 57 61 69 74 | 4e 65 78 74 45 76 65 6e |le(_Wait|NextEven|
|00003960| 74 2c 20 54 6f 6f 6c 54 | 72 61 70 29 3b 0d 0d 09 |t, ToolT|rap);...|
|00003970| 7b 31 2e 30 31 20 2d 20 | 57 65 20 75 73 65 64 20 |{1.01 - |We used |
|00003980| 74 6f 20 6d 61 6b 65 20 | 61 20 63 68 65 63 6b 20 |to make |a check |
|00003990| 66 6f 72 20 6d 65 6d 6f | 72 79 20 61 74 20 74 68 |for memo|ry at th|
|000039a0| 69 73 20 70 6f 69 6e 74 | 20 62 79 20 65 78 61 6d |is point| by exam|
|000039b0| 69 6e 69 6e 67 20 41 70 | 70 6c 4c 69 6d 69 74 2c |ining Ap|plLimit,|
|000039c0| 0d 09 20 41 70 70 6c 69 | 63 5a 6f 6e 65 2c 20 61 |.. Appli|cZone, a|
|000039d0| 6e 64 20 53 74 61 63 6b | 53 70 61 63 65 20 61 6e |nd Stack|Space an|
|000039e0| 64 20 63 6f 6d 70 61 72 | 69 6e 67 20 74 68 61 74 |d compar|ing that|
|000039f0| 20 74 6f 20 74 68 65 20 | 6d 69 6e 69 6d 75 6d 20 | to the |minimum |
|00003a00| 73 69 7a 65 20 77 65 20 | 74 6f 6c 64 0d 09 20 4d |size we |told.. M|
|00003a10| 75 6c 74 69 46 69 6e 64 | 65 72 20 77 65 20 6e 65 |ultiFind|er we ne|
|00003a20| 65 64 65 64 2e 20 54 68 | 69 73 20 64 69 64 20 6e |eded. Th|is did n|
|00003a30| 6f 74 20 77 6f 72 6b 20 | 77 65 6c 6c 20 62 65 63 |ot work |well bec|
|00003a40| 61 75 73 65 20 69 74 20 | 61 73 73 75 6d 65 64 20 |ause it |assumed |
|00003a50| 74 6f 6f 20 6d 75 63 68 | 20 61 62 6f 75 74 0d 09 |too much| about..|
|00003a60| 20 74 68 65 20 72 65 6c | 61 74 69 6f 6e 73 68 69 | the rel|ationshi|
|00003a70| 70 20 62 65 74 77 65 65 | 6e 20 77 68 61 74 20 77 |p betwee|n what w|
|00003a80| 65 20 61 73 6b 65 64 20 | 4d 75 6c 74 69 46 69 6e |e asked |MultiFin|
|00003a90| 64 65 72 20 66 6f 72 20 | 61 6e 64 20 77 68 61 74 |der for |and what|
|00003aa0| 20 77 65 20 77 6f 75 6c | 64 20 61 63 74 75 61 6c | we woul|d actual|
|00003ab0| 6c 79 0d 09 20 67 65 74 | 20 62 61 63 6b 2c 20 61 |ly.. get| back, a|
|00003ac0| 73 20 77 65 6c 6c 20 61 | 73 20 68 6f 77 20 74 6f |s well a|s how to|
|00003ad0| 20 6d 65 61 73 75 72 65 | 20 69 74 2e 20 49 6e 73 | measure| it. Ins|
|00003ae0| 74 65 61 64 2c 20 77 65 | 20 77 69 6c 6c 20 75 73 |tead, we| will us|
|00003af0| 65 20 61 6e 20 61 6c 74 | 65 72 6e 61 74 65 0d 09 |e an alt|ernate..|
|00003b00| 20 6d 65 74 68 6f 64 20 | 63 6f 6d 70 72 69 73 65 | method |comprise|
|00003b10| 64 20 6f 66 20 74 77 6f | 20 73 74 65 70 73 2e 7d |d of two| steps.}|
|00003b20| 0d 09 20 0d 09 7b 49 74 | 20 69 73 20 62 65 74 74 |.. ..{It| is bett|
|00003b30| 65 72 20 74 6f 20 66 69 | 72 73 74 20 63 68 65 63 |er to fi|rst chec|
|00003b40| 6b 20 74 68 65 20 73 69 | 7a 65 20 6f 66 20 74 68 |k the si|ze of th|
|00003b50| 65 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 68 65 |e applic|ation he|
|00003b60| 61 70 20 61 67 61 69 6e | 73 74 20 61 20 76 61 6c |ap again|st a val|
|00003b70| 75 65 0d 09 20 74 68 61 | 74 20 79 6f 75 20 68 61 |ue.. tha|t you ha|
|00003b80| 76 65 20 64 65 74 65 72 | 6d 69 6e 65 64 20 69 73 |ve deter|mined is|
|00003b90| 20 74 68 65 20 73 6d 61 | 6c 6c 65 73 74 20 68 65 | the sma|llest he|
|00003ba0| 61 70 20 74 68 65 20 61 | 70 70 6c 69 63 61 74 69 |ap the a|pplicati|
|00003bb0| 6f 6e 20 63 61 6e 20 72 | 65 61 73 6f 6e 61 62 6c |on can r|easonabl|
|00003bc0| 79 0d 09 20 77 6f 72 6b | 20 69 6e 2e 20 54 68 69 |y.. work| in. Thi|
|00003bd0| 73 20 6e 75 6d 62 65 72 | 20 73 68 6f 75 6c 64 20 |s number| should |
|00003be0| 62 65 20 64 65 72 69 76 | 65 64 20 62 79 20 65 78 |be deriv|ed by ex|
|00003bf0| 61 6d 69 6e 69 6e 67 20 | 74 68 65 20 73 69 7a 65 |amining |the size|
|00003c00| 20 6f 66 20 74 68 65 20 | 68 65 61 70 20 74 68 61 | of the |heap tha|
|00003c10| 74 0d 09 20 69 73 20 61 | 63 74 75 61 6c 6c 79 20 |t.. is a|ctually |
|00003c20| 70 72 6f 76 69 64 65 64 | 20 62 79 20 4d 75 6c 74 |provided| by Mult|
|00003c30| 69 46 69 6e 64 65 72 20 | 77 68 65 6e 20 74 68 65 |iFinder |when the|
|00003c40| 20 6d 69 6e 69 6d 75 6d | 20 73 69 7a 65 20 72 65 | minimum| size re|
|00003c50| 71 75 65 73 74 65 64 20 | 69 73 20 75 73 65 64 2e |quested |is used.|
|00003c60| 0d 09 20 54 68 65 20 64 | 65 72 69 76 61 74 69 6f |.. The d|erivatio|
|00003c70| 6e 20 6f 66 20 74 68 65 | 20 6d 69 6e 69 6d 75 6d |n of the| minimum|
|00003c80| 20 73 69 7a 65 20 72 65 | 71 75 65 73 74 65 64 20 | size re|quested |
|00003c90| 66 72 6f 6d 20 4d 75 6c | 74 69 46 69 6e 64 65 72 |from Mul|tiFinder|
|00003ca0| 20 69 73 20 64 65 73 63 | 72 69 62 65 64 0d 09 20 | is desc|ribed.. |
|00003cb0| 69 6e 20 53 61 6d 70 6c | 65 2e 68 2e 20 54 68 65 |in Sampl|e.h. The|
|00003cc0| 20 63 68 65 63 6b 20 73 | 68 6f 75 6c 64 20 62 65 | check s|hould be|
|00003cd0| 20 6d 61 64 65 20 62 65 | 63 61 75 73 65 20 74 68 | made be|cause th|
|00003ce0| 65 20 70 72 65 66 65 72 | 72 65 64 20 73 69 7a 65 |e prefer|red size|
|00003cf0| 20 63 61 6e 20 65 6e 64 | 20 75 70 0d 09 20 62 65 | can end| up.. be|
|00003d00| 69 6e 67 20 73 65 74 20 | 73 6d 61 6c 6c 65 72 20 |ing set |smaller |
|00003d10| 74 68 61 6e 20 74 68 65 | 20 6d 69 6e 69 6d 75 6d |than the| minimum|
|00003d20| 20 73 69 7a 65 20 62 79 | 20 74 68 65 20 75 73 65 | size by| the use|
|00003d30| 72 2e 20 54 68 69 73 20 | 65 78 74 72 61 20 63 68 |r. This |extra ch|
|00003d40| 65 63 6b 20 61 63 74 73 | 20 74 6f 0d 09 20 69 6e |eck acts| to.. in|
|00003d50| 73 75 72 65 20 74 68 61 | 74 20 79 6f 75 72 20 61 |sure tha|t your a|
|00003d60| 70 70 6c 69 63 61 74 69 | 6f 6e 20 69 73 20 73 74 |pplicati|on is st|
|00003d70| 61 72 74 69 6e 67 20 66 | 72 6f 6d 20 61 20 73 6f |arting f|rom a so|
|00003d80| 6c 69 64 20 6d 65 6d 6f | 72 79 20 66 6f 75 6e 64 |lid memo|ry found|
|00003d90| 61 74 69 6f 6e 2e 7d 0d | 09 20 0d 09 49 46 20 4f |ation.}.|. ..IF O|
|00003da0| 52 44 28 47 65 74 41 70 | 70 6c 4c 69 6d 69 74 29 |RD(GetAp|plLimit)|
|00003db0| 20 2d 20 4f 52 44 28 41 | 70 70 6c 69 63 5a 6f 6e | - ORD(A|pplicZon|
|00003dc0| 65 29 20 3c 20 6b 4d 69 | 6e 48 65 61 70 20 54 48 |e) < kMi|nHeap TH|
|00003dd0| 45 4e 20 41 6c 65 72 74 | 55 73 65 72 3b 0d 09 0d |EN Alert|User;...|
|00003de0| 09 7b 4e 65 78 74 2c 20 | 6d 61 6b 65 20 73 75 72 |.{Next, |make sur|
|00003df0| 65 20 74 68 61 74 20 65 | 6e 6f 75 67 68 20 6d 65 |e that e|nough me|
|00003e00| 6d 6f 72 79 20 69 73 20 | 66 72 65 65 20 66 6f 72 |mory is |free for|
|00003e10| 20 79 6f 75 72 20 61 70 | 70 6c 69 63 61 74 69 6f | your ap|plicatio|
|00003e20| 6e 20 74 6f 20 72 75 6e | 2e 20 49 74 0d 09 20 69 |n to run|. It.. i|
|00003e30| 73 20 70 6f 73 73 69 62 | 6c 65 20 66 6f 72 20 61 |s possib|le for a|
|00003e40| 20 73 69 74 75 61 74 69 | 6f 6e 20 74 6f 20 61 72 | situati|on to ar|
|00003e50| 69 73 65 20 77 68 65 72 | 65 20 74 68 65 20 68 65 |ise wher|e the he|
|00003e60| 61 70 20 6d 61 79 20 68 | 61 76 65 20 62 65 65 6e |ap may h|ave been|
|00003e70| 20 6f 66 20 72 65 71 75 | 69 72 65 64 0d 09 20 73 | of requ|ired.. s|
|00003e80| 69 7a 65 2c 20 62 75 74 | 20 61 20 6c 61 72 67 65 |ize, but| a large|
|00003e90| 20 73 63 72 61 70 20 77 | 61 73 20 6c 6f 61 64 65 | scrap w|as loade|
|00003ea0| 64 20 77 68 69 63 68 20 | 6c 65 66 74 20 74 6f 6f |d which |left too|
|00003eb0| 20 6c 69 74 74 6c 65 20 | 6d 65 6d 6f 72 79 2e 20 | little |memory. |
|00003ec0| 54 6f 20 63 68 65 63 6b | 20 66 6f 72 0d 09 20 74 |To check| for.. t|
|00003ed0| 68 69 73 2c 20 63 61 6c | 6c 20 50 75 72 67 65 53 |his, cal|l PurgeS|
|00003ee0| 70 61 63 65 20 61 6e 64 | 20 63 6f 6d 70 61 72 65 |pace and| compare|
|00003ef0| 20 74 68 65 20 72 65 73 | 75 6c 74 20 77 69 74 68 | the res|ult with|
|00003f00| 20 61 20 76 61 6c 75 65 | 20 74 68 61 74 20 79 6f | a value| that yo|
|00003f10| 75 20 68 61 76 65 20 64 | 65 74 65 72 6d 69 6e 65 |u have d|etermine|
|00003f20| 64 0d 09 20 69 73 20 74 | 68 65 20 6d 69 6e 69 6d |d.. is t|he minim|
|00003f30| 75 6d 20 61 6d 6f 75 6e | 74 20 6f 66 20 66 72 65 |um amoun|t of fre|
|00003f40| 65 20 6d 65 6d 6f 72 79 | 20 79 6f 75 72 20 61 70 |e memory| your ap|
|00003f50| 70 6c 69 63 61 74 69 6f | 6e 20 6e 65 65 64 73 20 |plicatio|n needs |
|00003f60| 61 74 20 69 6e 69 74 69 | 61 6c 69 7a 61 74 69 6f |at initi|alizatio|
|00003f70| 6e 2e 0d 09 20 54 68 69 | 73 20 6e 75 6d 62 65 72 |n... Thi|s number|
|00003f80| 20 63 61 6e 20 62 65 20 | 64 65 72 69 76 65 64 20 | can be |derived |
|00003f90| 73 65 76 65 72 61 6c 20 | 64 69 66 66 65 72 65 6e |several |differen|
|00003fa0| 74 20 77 61 79 73 2e 20 | 4f 6e 65 20 77 61 79 20 |t ways. |One way |
|00003fb0| 74 68 61 74 20 69 73 20 | 66 61 69 72 6c 79 0d 09 |that is |fairly..|
|00003fc0| 20 73 74 72 61 69 67 68 | 74 66 6f 72 77 61 72 64 | straigh|tforward|
|00003fd0| 20 69 73 20 74 6f 20 72 | 75 6e 20 74 68 65 20 61 | is to r|un the a|
|00003fe0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 69 6e 20 74 68 |pplicati|on in th|
|00003ff0| 65 20 6d 69 6e 69 6d 75 | 6d 20 73 69 7a 65 20 63 |e minimu|m size c|
|00004000| 6f 6e 66 69 67 75 72 61 | 74 69 6f 6e 0d 09 20 61 |onfigura|tion.. a|
|00004010| 73 20 64 65 73 63 72 69 | 62 65 64 20 70 72 65 76 |s descri|bed prev|
|00004020| 69 6f 75 73 6c 79 2e 20 | 43 61 6c 6c 20 50 75 72 |iously. |Call Pur|
|00004030| 67 65 53 70 61 63 65 20 | 61 74 20 69 6e 69 74 69 |geSpace |at initi|
|00004040| 61 6c 69 7a 61 74 69 6f | 6e 20 61 6e 64 20 65 78 |alizatio|n and ex|
|00004050| 61 6d 69 6e 65 20 74 68 | 65 20 76 61 6c 75 65 0d |amine th|e value.|
|00004060| 09 20 72 65 74 75 72 6e | 65 64 2e 20 48 6f 77 65 |. return|ed. Howe|
|00004070| 76 65 72 2c 20 79 6f 75 | 20 73 68 6f 75 6c 64 20 |ver, you| should |
|00004080| 6d 61 6b 65 20 73 75 72 | 65 20 74 68 61 74 20 74 |make sur|e that t|
|00004090| 68 69 73 20 72 65 73 75 | 6c 74 20 69 73 20 6e 6f |his resu|lt is no|
|000040a0| 74 20 62 65 69 6e 67 20 | 6d 6f 64 69 66 69 65 64 |t being |modified|
|000040b0| 0d 09 20 62 79 20 74 68 | 65 20 73 63 72 61 70 27 |.. by th|e scrap'|
|000040c0| 73 20 70 72 65 73 65 6e | 63 65 2e 20 59 6f 75 20 |s presen|ce. You |
|000040d0| 63 61 6e 20 64 6f 20 74 | 68 61 74 20 62 79 20 63 |can do t|hat by c|
|000040e0| 61 6c 6c 69 6e 67 20 5a | 65 72 6f 53 63 72 61 70 |alling Z|eroScrap|
|000040f0| 20 62 65 66 6f 72 65 20 | 63 61 6c 6c 69 6e 67 0d | before |calling.|
|00004100| 09 20 50 75 72 67 65 53 | 70 61 63 65 2e 20 4d 61 |. PurgeS|pace. Ma|
|00004110| 6b 65 20 73 75 72 65 20 | 74 6f 20 72 65 6d 6f 76 |ke sure |to remov|
|00004120| 65 20 74 68 61 74 20 63 | 61 6c 6c 20 62 65 66 6f |e that c|all befo|
|00004130| 72 65 20 73 68 69 70 70 | 69 6e 67 2c 20 74 68 6f |re shipp|ing, tho|
|00004140| 75 67 68 2e 7d 0d 09 20 | 0d 09 50 75 72 67 65 53 |ugh.}.. |..PurgeS|
|00004150| 70 61 63 65 28 74 6f 74 | 61 6c 2c 20 63 6f 6e 74 |pace(tot|al, cont|
|00004160| 69 67 29 3b 0d 09 49 46 | 20 74 6f 74 61 6c 20 3c |ig);..IF| total <|
|00004170| 20 6b 4d 69 6e 53 70 61 | 63 65 20 54 48 45 4e 20 | kMinSpa|ce THEN |
|00004180| 41 6c 65 72 74 55 73 65 | 72 3b 0d 0d 09 7b 54 68 |AlertUse|r;...{Th|
|00004190| 65 20 65 78 74 72 61 20 | 62 65 6e 65 66 69 74 20 |e extra |benefit |
|000041a0| 74 6f 20 77 61 69 74 6e | 67 20 75 6e 74 69 6c 20 |to waitn|g until |
|000041b0| 61 66 74 65 72 20 74 68 | 65 20 54 6f 6f 6c 62 6f |after th|e Toolbo|
|000041c0| 78 20 4d 61 6e 61 67 65 | 72 73 20 68 61 76 65 20 |x Manage|rs have |
|000041d0| 62 65 65 6e 20 69 6e 69 | 74 69 61 6c 69 7a 65 64 |been ini|tialized|
|000041e0| 0d 09 20 62 65 66 6f 72 | 65 20 63 68 65 63 6b 69 |.. befor|e checki|
|000041f0| 6e 67 20 6d 65 6d 6f 72 | 79 20 69 73 20 74 68 61 |ng memor|y is tha|
|00004200| 74 20 77 65 20 63 61 6e | 20 6e 6f 77 20 67 69 76 |t we can| now giv|
|00004210| 65 20 74 68 65 20 75 73 | 65 72 20 61 6e 20 61 6c |e the us|er an al|
|00004220| 65 72 74 20 74 6f 20 74 | 65 6c 6c 20 68 69 6d 20 |ert to t|ell him |
|00004230| 77 68 61 74 0d 09 20 68 | 61 70 70 65 6e 65 64 2e |what.. h|appened.|
|00004240| 20 41 6c 74 68 6f 75 67 | 68 20 69 74 20 69 73 20 | Althoug|h it is |
|00004250| 70 6f 73 73 69 62 6c 65 | 20 74 68 61 74 20 74 68 |possible| that th|
|00004260| 65 20 6d 65 6d 6f 72 79 | 20 73 69 74 75 61 74 69 |e memory| situati|
|00004270| 6f 6e 20 63 6f 75 6c 64 | 20 62 65 20 77 6f 72 73 |on could| be wors|
|00004280| 65 6e 65 64 20 62 79 0d | 09 20 64 69 73 70 6c 61 |ened by.|. displa|
|00004290| 79 69 6e 67 20 61 6e 20 | 61 6c 65 72 74 2c 20 4d |ying an |alert, M|
|000042a0| 75 6c 74 69 46 69 6e 64 | 65 72 20 77 6f 75 6c 64 |ultiFind|er would|
|000042b0| 20 67 72 61 63 65 66 75 | 6c 6c 79 20 65 78 69 74 | gracefu|lly exit|
|000042c0| 20 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | the app|lication|
|000042d0| 20 77 69 74 68 0d 09 20 | 61 6e 20 69 6e 66 6f 72 | with.. |an infor|
|000042e0| 6d 61 74 69 76 65 20 61 | 6c 65 72 74 20 69 66 20 |mative a|lert if |
|000042f0| 6d 65 6d 6f 72 79 20 62 | 65 63 61 6d 65 20 63 72 |memory b|ecame cr|
|00004300| 69 74 69 63 61 6c 2e 20 | 48 65 72 65 20 77 65 20 |itical. |Here we |
|00004310| 61 72 65 20 61 63 74 69 | 6e 67 20 6d 6f 72 65 0d |are acti|ng more.|
|00004320| 09 20 69 6e 20 61 20 70 | 72 65 76 65 6e 74 61 74 |. in a p|reventat|
|00004330| 69 76 65 20 6d 61 6e 6e | 65 72 20 74 6f 20 61 76 |ive mann|er to av|
|00004340| 6f 69 64 20 66 75 74 75 | 72 65 20 64 69 73 61 73 |oid futu|re disas|
|00004350| 74 65 72 20 66 72 6f 6d | 20 6c 6f 77 2d 6d 65 6d |ter from| low-mem|
|00004360| 6f 72 79 20 70 72 6f 62 | 6c 65 6d 73 2e 7d 0d 09 |ory prob|lems.}..|
|00004370| 20 0d 09 7b 57 65 20 77 | 69 6c 6c 20 61 6c 6c 6f | ..{We w|ill allo|
|00004380| 63 61 74 65 20 6f 75 72 | 20 6f 77 6e 20 77 69 6e |cate our| own win|
|00004390| 64 6f 77 20 73 74 6f 72 | 61 67 65 20 69 6e 73 74 |dow stor|age inst|
|000043a0| 65 61 64 20 6f 66 20 6c | 65 74 74 69 6e 67 20 74 |ead of l|etting t|
|000043b0| 68 65 20 57 69 6e 64 6f | 77 0d 09 20 4d 61 6e 61 |he Windo|w.. Mana|
|000043c0| 67 65 72 20 66 6f 72 20 | 74 77 6f 20 72 65 61 73 |ger for |two reas|
|000043d0| 6f 6e 73 2e 20 4f 6e 65 | 2c 20 47 65 74 4e 65 77 |ons. One|, GetNew|
|000043e0| 57 69 6e 64 6f 77 20 6c | 6f 63 6b 73 20 74 68 65 |Window l|ocks the|
|000043f0| 20 27 57 49 4e 44 27 20 | 72 65 73 6f 75 72 63 65 | 'WIND' |resource|
|00004400| 0d 09 20 68 61 6e 64 6c | 65 20 62 65 66 6f 72 65 |.. handl|e before|
|00004410| 20 63 61 6c 6c 69 6e 67 | 20 4e 65 77 57 69 6e 64 | calling| NewWind|
|00004420| 6f 77 20 61 6e 64 20 74 | 68 69 73 20 63 61 6e 20 |ow and t|his can |
|00004430| 6c 65 61 64 20 74 6f 20 | 68 65 61 70 20 66 72 61 |lead to |heap fra|
|00004440| 67 6d 65 6e 74 61 74 69 | 6f 6e 2e 0d 09 20 54 77 |gmentati|on... Tw|
|00004450| 6f 2c 20 69 74 20 74 61 | 6b 65 73 20 6a 75 73 74 |o, it ta|kes just|
|00004460| 20 61 73 20 6d 75 63 68 | 20 74 69 6d 65 20 66 6f | as much| time fo|
|00004470| 72 20 4e 65 77 57 69 6e | 64 6f 77 20 74 6f 20 67 |r NewWin|dow to g|
|00004480| 65 74 20 74 68 65 20 6d | 65 6d 6f 72 79 20 61 73 |et the m|emory as|
|00004490| 20 69 74 0d 09 20 64 6f | 65 73 20 66 6f 72 20 75 | it.. do|es for u|
|000044a0| 73 20 74 6f 20 67 65 74 | 20 69 74 2e 7d 0d 0d 09 |s to get| it.}...|
|000044b0| 77 69 6e 64 6f 77 20 3a | 3d 20 57 69 6e 64 6f 77 |window :|= Window|
|000044c0| 50 74 72 28 4e 65 77 50 | 74 72 28 53 49 5a 45 4f |Ptr(NewP|tr(SIZEO|
|000044d0| 46 28 57 69 6e 64 6f 77 | 52 65 63 6f 72 64 29 29 |F(Window|Record))|
|000044e0| 29 3b 0d 09 49 46 20 77 | 69 6e 64 6f 77 20 3d 20 |);..IF w|indow = |
|000044f0| 4e 49 4c 20 54 48 45 4e | 20 41 6c 65 72 74 55 73 |NIL THEN| AlertUs|
|00004500| 65 72 3b 0d 09 77 69 6e | 64 6f 77 20 3a 3d 20 47 |er;..win|dow := G|
|00004510| 65 74 4e 65 77 57 69 6e | 64 6f 77 28 72 57 69 6e |etNewWin|dow(rWin|
|00004520| 64 6f 77 2c 20 50 74 72 | 28 77 69 6e 64 6f 77 29 |dow, Ptr|(window)|
|00004530| 2c 20 57 69 6e 64 6f 77 | 50 74 72 28 2d 31 29 29 |, Window|Ptr(-1))|
|00004540| 3b 0d 0d 09 6d 65 6e 75 | 42 61 72 20 3a 3d 20 47 |;...menu|Bar := G|
|00004550| 65 74 4e 65 77 4d 42 61 | 72 28 72 4d 65 6e 75 42 |etNewMBa|r(rMenuB|
|00004560| 61 72 29 3b 09 09 7b 72 | 65 61 64 20 6d 65 6e 75 |ar);..{r|ead menu|
|00004570| 73 20 69 6e 74 6f 20 6d | 65 6e 75 20 62 61 72 7d |s into m|enu bar}|
|00004580| 0d 09 49 46 20 6d 65 6e | 75 42 61 72 20 3d 20 4e |..IF men|uBar = N|
|00004590| 49 4c 20 54 48 45 4e 20 | 41 6c 65 72 74 55 73 65 |IL THEN |AlertUse|
|000045a0| 72 3b 0d 09 53 65 74 4d | 65 6e 75 42 61 72 28 6d |r;..SetM|enuBar(m|
|000045b0| 65 6e 75 42 61 72 29 3b | 09 09 09 09 09 7b 69 6e |enuBar);|.....{in|
|000045c0| 73 74 61 6c 6c 20 6d 65 | 6e 75 73 7d 0d 09 44 69 |stall me|nus}..Di|
|000045d0| 73 70 6f 73 48 61 6e 64 | 6c 65 28 6d 65 6e 75 42 |sposHand|le(menuB|
|000045e0| 61 72 29 3b 0d 09 41 64 | 64 52 65 73 4d 65 6e 75 |ar);..Ad|dResMenu|
|000045f0| 28 47 65 74 4d 48 61 6e | 64 6c 65 28 6d 41 70 70 |(GetMHan|dle(mApp|
|00004600| 6c 65 29 2c 20 27 44 52 | 56 52 27 29 3b 09 7b 61 |le), 'DR|VR');.{a|
|00004610| 64 64 20 44 41 20 6e 61 | 6d 65 73 20 74 6f 20 41 |dd DA na|mes to A|
|00004620| 70 70 6c 65 20 6d 65 6e | 75 7d 0d 09 44 72 61 77 |pple men|u}..Draw|
|00004630| 4d 65 6e 75 42 61 72 3b | 0d 0d 09 67 53 74 6f 70 |MenuBar;|...gStop|
|00004640| 70 65 64 20 3a 3d 20 54 | 52 55 45 3b 0d 09 49 46 |ped := T|RUE;..IF|
|00004650| 20 4e 4f 54 20 47 6f 47 | 65 74 52 65 63 74 28 72 | NOT GoG|etRect(r|
|00004660| 53 74 6f 70 52 65 63 74 | 2c 20 67 53 74 6f 70 52 |StopRect|, gStopR|
|00004670| 65 63 74 29 20 54 48 45 | 4e 0d 09 09 41 6c 65 72 |ect) THE|N...Aler|
|00004680| 74 55 73 65 72 3b 09 09 | 09 09 09 09 09 7b 74 68 |tUser;..|.....{th|
|00004690| 65 20 73 74 6f 70 20 6c | 69 67 68 74 20 72 65 63 |e stop l|ight rec|
|000046a0| 74 61 6e 67 6c 65 7d 0d | 09 49 46 20 4e 4f 54 20 |tangle}.|.IF NOT |
|000046b0| 47 6f 47 65 74 52 65 63 | 74 28 72 47 6f 52 65 63 |GoGetRec|t(rGoRec|
|000046c0| 74 2c 20 67 47 6f 52 65 | 63 74 29 20 54 48 45 4e |t, gGoRe|ct) THEN|
|000046d0| 0d 09 09 41 6c 65 72 74 | 55 73 65 72 3b 09 09 09 |...Alert|User;...|
|000046e0| 09 09 09 09 7b 74 68 65 | 20 67 6f 20 6c 69 67 68 |....{the| go ligh|
|000046f0| 74 20 72 65 63 74 61 6e | 67 6c 65 7d 0d 45 4e 44 |t rectan|gle}.END|
|00004700| 3b 20 7b 49 6e 69 74 69 | 61 6c 69 7a 65 7d 0d 0d |; {Initi|alize}..|
|00004710| 0d 28 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |.(******|********|
|00004720| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004730| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004740| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004750| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004760| 2a 2a 2a 2a 2a 2a 2a 2a | 0d 31 2e 30 31 20 2d 20 |********|.1.01 - |
|00004770| 50 52 4f 43 45 44 55 52 | 45 20 44 6f 43 6c 6f 73 |PROCEDUR|E DoClos|
|00004780| 65 42 65 68 69 6e 64 28 | 77 69 6e 64 6f 77 3a 20 |eBehind(|window: |
|00004790| 57 69 6e 64 6f 77 50 74 | 72 29 3b 20 77 61 73 20 |WindowPt|r); was |
|000047a0| 72 65 6d 6f 76 65 64 2e | 0d 0d 7b 31 2e 30 31 20 |removed.|..{1.01 |
|000047b0| 2d 20 44 6f 43 6c 6f 73 | 65 42 65 68 69 6e 64 20 |- DoClos|eBehind |
|000047c0| 77 61 73 20 61 20 67 6f | 6f 64 20 69 64 65 61 20 |was a go|od idea |
|000047d0| 66 6f 72 20 63 6c 6f 73 | 69 6e 67 20 77 69 6e 64 |for clos|ing wind|
|000047e0| 6f 77 73 20 77 68 65 6e | 20 71 75 69 74 74 69 6e |ows when| quittin|
|000047f0| 67 0d 20 61 6e 64 20 6e | 6f 74 20 68 61 76 69 6e |g. and n|ot havin|
|00004800| 67 20 74 6f 20 77 6f 72 | 72 79 20 61 62 6f 75 74 |g to wor|ry about|
|00004810| 20 75 70 64 61 74 69 6e | 67 20 74 68 65 20 77 69 | updatin|g the wi|
|00004820| 6e 64 6f 77 73 2c 20 62 | 75 74 20 69 74 20 73 75 |ndows, b|ut it su|
|00004830| 66 66 65 72 65 64 0d 20 | 66 72 6f 6d 20 61 20 66 |ffered. |from a f|
|00004840| 61 74 61 6c 20 66 6c 61 | 77 2e 20 49 66 20 61 20 |atal fla|w. If a |
|00004850| 64 65 73 6b 20 61 63 63 | 65 73 73 6f 72 79 20 6f |desk acc|essory o|
|00004860| 77 6e 65 64 20 74 77 6f | 20 77 69 6e 64 6f 77 73 |wned two| windows|
|00004870| 2c 20 69 74 20 77 6f 75 | 6c 64 0d 20 63 6c 6f 73 |, it wou|ld. clos|
|00004880| 65 20 62 6f 74 68 20 74 | 68 6f 73 65 20 77 69 6e |e both t|hose win|
|00004890| 64 6f 77 73 20 77 68 65 | 6e 20 43 6c 6f 73 65 44 |dows whe|n CloseD|
|000048a0| 65 73 6b 41 63 63 20 77 | 61 73 20 63 61 6c 6c 65 |eskAcc w|as calle|
|000048b0| 64 2e 20 57 68 65 6e 20 | 44 6f 43 6c 6f 73 65 42 |d. When |DoCloseB|
|000048c0| 65 68 69 6e 64 0d 20 67 | 6f 74 20 61 72 6f 75 6e |ehind. g|ot aroun|
|000048d0| 64 20 74 6f 20 63 61 6c | 6c 69 6e 67 20 44 6f 43 |d to cal|ling DoC|
|000048e0| 6c 6f 73 65 57 69 6e 64 | 6f 77 20 66 6f 72 20 74 |loseWind|ow for t|
|000048f0| 68 61 74 20 6f 74 68 65 | 72 20 77 69 6e 64 6f 77 |hat othe|r window|
|00004900| 20 74 68 61 74 20 77 61 | 73 20 61 6c 72 65 61 64 | that wa|s alread|
|00004910| 79 0d 20 63 6c 6f 73 65 | 64 2c 20 74 68 69 6e 67 |y. close|d, thing|
|00004920| 73 20 77 6f 75 6c 64 20 | 67 6f 20 76 65 72 79 20 |s would |go very |
|00004930| 70 6f 6f 72 6c 79 2e 20 | 41 6e 6f 74 68 65 72 20 |poorly. |Another |
|00004940| 6f 70 74 69 6f 6e 20 77 | 6f 75 6c 64 20 62 65 20 |option w|ould be |
|00004950| 74 6f 20 68 61 76 65 20 | 61 0d 20 70 72 6f 63 65 |to have |a. proce|
|00004960| 64 75 72 65 2c 20 47 65 | 74 52 65 61 72 57 69 6e |dure, Ge|tRearWin|
|00004970| 64 6f 77 2c 20 74 68 61 | 74 20 77 6f 75 6c 64 20 |dow, tha|t would |
|00004980| 67 6f 20 74 68 72 6f 75 | 67 68 20 74 68 65 20 77 |go throu|gh the w|
|00004990| 69 6e 64 6f 77 20 6c 69 | 73 74 20 61 6e 64 20 72 |indow li|st and r|
|000049a0| 65 74 75 72 6e 0d 20 74 | 68 65 20 6c 61 73 74 20 |eturn. t|he last |
|000049b0| 77 69 6e 64 6f 77 2e 20 | 49 6e 73 74 65 61 64 2c |window. |Instead,|
|000049c0| 20 77 65 20 64 65 63 69 | 64 65 64 20 74 6f 20 70 | we deci|ded to p|
|000049d0| 72 65 73 65 6e 74 20 74 | 68 65 20 73 74 61 6e 64 |resent t|he stand|
|000049e0| 61 72 64 20 61 70 70 72 | 6f 61 63 68 0d 20 6f 66 |ard appr|oach. of|
|000049f0| 20 67 65 74 74 69 6e 67 | 20 61 6e 64 20 63 6c 6f | getting| and clo|
|00004a00| 73 69 6e 67 20 46 72 6f | 6e 74 57 69 6e 64 6f 77 |sing Fro|ntWindow|
|00004a10| 20 75 6e 74 69 6c 20 46 | 72 6f 6e 74 57 69 6e 64 | until F|rontWind|
|00004a20| 6f 77 20 72 65 74 75 72 | 6e 73 20 4e 49 4c 2e 20 |ow retur|ns NIL. |
|00004a30| 54 68 69 73 0d 20 68 61 | 73 20 61 20 70 6f 74 65 |This. ha|s a pote|
|00004a40| 6e 74 69 61 6c 20 62 65 | 6e 65 66 69 74 20 69 6e |ntial be|nefit in|
|00004a50| 20 74 68 61 74 20 74 68 | 65 20 77 69 6e 64 6f 77 | that th|e window|
|00004a60| 20 77 68 6f 73 65 20 64 | 6f 63 75 6d 65 6e 74 20 | whose d|ocument |
|00004a70| 6e 65 65 64 73 20 74 6f | 20 62 65 20 73 61 76 65 |needs to| be save|
|00004a80| 64 0d 20 6d 61 79 20 62 | 65 20 76 69 73 69 62 6c |d. may b|e visibl|
|00004a90| 65 20 73 69 6e 63 65 20 | 69 74 20 69 73 20 74 68 |e since |it is th|
|00004aa0| 65 20 66 72 6f 6e 74 20 | 77 69 6e 64 6f 77 2c 20 |e front |window, |
|00004ab0| 74 68 65 72 65 66 6f 72 | 65 20 64 65 63 72 65 61 |therefor|e decrea|
|00004ac0| 73 69 6e 67 20 74 68 65 | 0d 20 63 68 61 6e 63 65 |sing the|. chance|
|00004ad0| 20 6f 66 20 75 73 65 72 | 20 63 6f 6e 66 75 73 69 | of user| confusi|
|00004ae0| 6f 6e 2e 20 46 6f 72 20 | 61 65 73 74 68 65 74 69 |on. For |aestheti|
|00004af0| 63 20 72 65 61 73 6f 6e | 73 2c 20 74 68 65 20 77 |c reason|s, the w|
|00004b00| 69 6e 64 6f 77 73 20 69 | 6e 20 74 68 65 0d 20 61 |indows i|n the. a|
|00004b10| 70 70 6c 69 63 61 74 69 | 6f 6e 20 73 68 6f 75 6c |pplicati|on shoul|
|00004b20| 64 20 62 65 20 63 68 65 | 63 6b 65 64 20 66 6f 72 |d be che|cked for|
|00004b30| 20 75 70 64 61 74 65 73 | 20 70 65 72 69 6f 64 69 | updates| periodi|
|00004b40| 63 61 6c 6c 79 20 61 6e | 64 20 68 61 76 65 20 74 |cally an|d have t|
|00004b50| 68 65 0d 20 75 70 64 61 | 74 65 73 20 73 65 72 76 |he. upda|tes serv|
|00004b60| 69 63 65 64 2e 7d 0d 2a | 2a 2a 2a 2a 2a 2a 2a 2a |iced.}.*|********|
|00004b70| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004b80| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004b90| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004ba0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004bb0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 29 0d 0d |********|*****)..|
|00004bc0| 0d 7b 24 53 20 4d 61 69 | 6e 7d 0d 50 52 4f 43 45 |.{$S Mai|n}.PROCE|
|00004bd0| 44 55 52 45 20 54 65 72 | 6d 69 6e 61 74 65 3b 0d |DURE Ter|minate;.|
|00004be0| 0d 7b 43 6c 65 61 6e 20 | 75 70 20 74 68 65 20 61 |.{Clean |up the a|
|00004bf0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 61 6e 64 20 65 |pplicati|on and e|
|00004c00| 78 69 74 73 2e 20 57 65 | 20 63 6c 6f 73 65 20 61 |xits. We| close a|
|00004c10| 6c 6c 20 6f 66 20 74 68 | 65 20 77 69 6e 64 6f 77 |ll of th|e window|
|00004c20| 73 20 73 6f 20 74 68 61 | 74 0d 20 74 68 65 79 20 |s so tha|t. they |
|00004c30| 63 61 6e 20 75 70 64 61 | 74 65 20 74 68 65 69 72 |can upda|te their|
|00004c40| 20 64 6f 63 75 6d 65 6e | 74 73 2c 20 69 66 20 61 | documen|ts, if a|
|00004c50| 6e 79 2e 7d 0d 20 0d 7b | 31 2e 30 31 20 2d 20 49 |ny.}. .{|1.01 - I|
|00004c60| 66 20 77 65 20 66 69 6e | 64 20 6f 75 74 20 74 68 |f we fin|d out th|
|00004c70| 61 74 20 61 20 63 61 6e | 63 65 6c 20 68 61 73 20 |at a can|cel has |
|00004c80| 6f 63 63 75 72 72 65 64 | 2c 20 77 65 20 77 6f 6e |occurred|, we won|
|00004c90| 27 74 20 65 78 69 74 20 | 74 6f 20 74 68 65 0d 20 |'t exit |to the. |
|00004ca0| 73 68 65 6c 6c 2c 20 62 | 75 74 20 77 69 6c 6c 20 |shell, b|ut will |
|00004cb0| 72 65 74 75 72 6e 20 69 | 6e 73 74 65 61 64 2e 7d |return i|nstead.}|
|00004cc0| 0d 20 0d 56 41 52 0d 09 | 61 57 69 6e 64 6f 77 09 |. .VAR..|aWindow.|
|00004cd0| 3a 20 57 69 6e 64 6f 77 | 50 74 72 3b 0d 09 63 6c |: Window|Ptr;..cl|
|00004ce0| 6f 73 65 64 09 3a 20 42 | 4f 4f 4c 45 41 4e 3b 0d |osed.: B|OOLEAN;.|
|00004cf0| 0d 42 45 47 49 4e 0d 09 | 63 6c 6f 73 65 64 20 3a |.BEGIN..|closed :|
|00004d00| 3d 20 54 52 55 45 3b 0d | 09 52 45 50 45 41 54 0d |= TRUE;.|.REPEAT.|
|00004d10| 09 09 61 57 69 6e 64 6f | 77 20 3a 3d 20 46 72 6f |..aWindo|w := Fro|
|00004d20| 6e 74 57 69 6e 64 6f 77 | 3b 09 09 09 09 09 7b 67 |ntWindow|;.....{g|
|00004d30| 65 74 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 66 |et the c|urrent f|
|00004d40| 72 6f 6e 74 20 77 69 6e | 64 6f 77 7d 0d 09 09 49 |ront win|dow}...I|
|00004d50| 46 20 61 57 69 6e 64 6f | 77 20 3c 3e 20 4e 49 4c |F aWindo|w <> NIL|
|00004d60| 20 54 48 45 4e 0d 09 09 | 09 63 6c 6f 73 65 64 20 | THEN...|.closed |
|00004d70| 3a 3d 20 44 6f 43 6c 6f | 73 65 57 69 6e 64 6f 77 |:= DoClo|seWindow|
|00004d80| 28 61 57 69 6e 64 6f 77 | 29 3b 09 7b 63 6c 6f 73 |(aWindow|);.{clos|
|00004d90| 65 20 74 68 69 73 20 77 | 69 6e 64 6f 77 7d 0d 09 |e this w|indow}..|
|00004da0| 55 4e 54 49 4c 20 28 4e | 4f 54 20 63 6c 6f 73 65 |UNTIL (N|OT close|
|00004db0| 64 29 20 7c 20 28 61 57 | 69 6e 64 6f 77 20 3d 20 |d) | (aW|indow = |
|00004dc0| 4e 49 4c 29 3b 09 09 7b | 64 6f 20 61 6c 6c 20 77 |NIL);..{|do all w|
|00004dd0| 69 6e 64 6f 77 73 7d 0d | 09 49 46 20 63 6c 6f 73 |indows}.|.IF clos|
|00004de0| 65 64 20 54 48 45 4e 0d | 09 09 45 78 69 74 54 6f |ed THEN.|..ExitTo|
|00004df0| 53 68 65 6c 6c 3b 09 09 | 09 09 09 09 09 7b 65 78 |Shell;..|.....{ex|
|00004e00| 69 74 20 69 66 20 6e 6f | 20 63 61 6e 63 65 6c 6c |it if no| cancell|
|00004e10| 61 74 69 6f 6e 7d 0d 45 | 4e 44 3b 20 7b 54 65 72 |ation}.E|ND; {Ter|
|00004e20| 6d 69 6e 61 74 65 7d 0d | 0d 0d 7b 24 53 20 4d 61 |minate}.|..{$S Ma|
|00004e30| 69 6e 7d 0d 50 52 4f 43 | 45 44 55 52 45 20 53 65 |in}.PROC|EDURE Se|
|00004e40| 74 4c 69 67 68 74 28 77 | 69 6e 64 6f 77 3a 20 57 |tLight(w|indow: W|
|00004e50| 69 6e 64 6f 77 50 74 72 | 3b 20 6e 65 77 53 74 6f |indowPtr|; newSto|
|00004e60| 70 70 65 64 3a 20 42 4f | 4f 4c 45 41 4e 29 3b 0d |pped: BO|OLEAN);.|
|00004e70| 0d 7b 43 68 61 6e 67 65 | 20 74 68 65 20 73 65 74 |.{Change| the set|
|00004e80| 74 69 6e 67 20 6f 66 20 | 74 68 65 20 6c 69 67 68 |ting of |the ligh|
|00004e90| 74 2e 7d 0d 0d 42 45 47 | 49 4e 0d 09 49 46 20 6e |t.}..BEG|IN..IF n|
|00004ea0| 65 77 53 74 6f 70 70 65 | 64 20 3c 3e 20 67 53 74 |ewStoppe|d <> gSt|
|00004eb0| 6f 70 70 65 64 20 54 48 | 45 4e 20 42 45 47 49 4e |opped TH|EN BEGIN|
|00004ec0| 0d 09 09 67 53 74 6f 70 | 70 65 64 20 3a 3d 20 6e |...gStop|ped := n|
|00004ed0| 65 77 53 74 6f 70 70 65 | 64 3b 0d 09 09 53 65 74 |ewStoppe|d;...Set|
|00004ee0| 50 6f 72 74 28 77 69 6e | 64 6f 77 29 3b 0d 09 09 |Port(win|dow);...|
|00004ef0| 49 6e 76 61 6c 52 65 63 | 74 28 77 69 6e 64 6f 77 |InvalRec|t(window|
|00004f00| 5e 2e 70 6f 72 74 52 65 | 63 74 29 3b 0d 09 45 4e |^.portRe|ct);..EN|
|00004f10| 44 3b 0d 45 4e 44 3b 20 | 7b 53 65 74 4c 69 67 68 |D;.END; |{SetLigh|
|00004f20| 74 7d 0d 0d 0d 7b 24 53 | 20 4d 61 69 6e 7d 0d 50 |t}...{$S| Main}.P|
|00004f30| 52 4f 43 45 44 55 52 45 | 20 41 64 6a 75 73 74 4d |ROCEDURE| AdjustM|
|00004f40| 65 6e 75 73 3b 0d 0d 7b | 45 6e 61 62 6c 65 20 61 |enus;..{|Enable a|
|00004f50| 6e 64 20 64 69 73 61 62 | 6c 65 20 6d 65 6e 75 73 |nd disab|le menus|
|00004f60| 20 62 61 73 65 64 20 6f | 6e 20 74 68 65 20 63 75 | based o|n the cu|
|00004f70| 72 72 65 6e 74 20 73 74 | 61 74 65 2e 0d 20 54 68 |rrent st|ate.. Th|
|00004f80| 65 20 75 73 65 72 20 63 | 61 6e 20 6f 6e 6c 79 20 |e user c|an only |
|00004f90| 73 65 6c 65 63 74 20 65 | 6e 61 62 6c 65 64 20 6d |select e|nabled m|
|00004fa0| 65 6e 75 20 69 74 65 6d | 73 2e 20 57 65 20 73 65 |enu item|s. We se|
|00004fb0| 74 20 75 70 20 61 6c 6c | 20 74 68 65 20 6d 65 6e |t up all| the men|
|00004fc0| 75 20 69 74 65 6d 73 0d | 20 62 65 66 6f 72 65 20 |u items.| before |
|00004fd0| 63 61 6c 6c 69 6e 67 20 | 4d 65 6e 75 53 65 6c 65 |calling |MenuSele|
|00004fe0| 63 74 20 6f 72 20 4d 65 | 6e 75 4b 65 79 2c 20 73 |ct or Me|nuKey, s|
|00004ff0| 69 6e 63 65 20 74 68 65 | 73 65 20 61 72 65 20 74 |ince the|se are t|
|00005000| 68 65 20 6f 6e 6c 79 20 | 74 69 6d 65 73 20 74 68 |he only |times th|
|00005010| 61 74 0d 20 61 20 6d 65 | 6e 75 20 69 74 65 6d 20 |at. a me|nu item |
|00005020| 63 61 6e 20 62 65 20 73 | 65 6c 65 63 74 65 64 2e |can be s|elected.|
|00005030| 20 4e 6f 74 65 20 74 68 | 61 74 20 4d 65 6e 75 53 | Note th|at MenuS|
|00005040| 65 6c 65 63 74 20 69 73 | 20 61 6c 73 6f 20 74 68 |elect is| also th|
|00005050| 65 20 6f 6e 6c 79 20 74 | 69 6d 65 0d 20 74 68 65 |e only t|ime. the|
|00005060| 20 75 73 65 72 20 77 69 | 6c 6c 20 73 65 65 20 6d | user wi|ll see m|
|00005070| 65 6e 75 20 69 74 65 6d | 73 2e 20 54 68 69 73 20 |enu item|s. This |
|00005080| 61 70 70 72 6f 61 63 68 | 20 74 6f 20 64 65 63 69 |approach| to deci|
|00005090| 64 69 6e 67 20 77 68 61 | 74 20 65 6e 61 62 6c 65 |ding wha|t enable|
|000050a0| 2f 0d 20 64 69 73 61 62 | 6c 65 20 73 74 61 74 65 |/. disab|le state|
|000050b0| 20 61 20 6d 65 6e 75 20 | 69 74 65 6d 20 68 61 73 | a menu |item has|
|000050c0| 20 74 68 65 20 61 64 76 | 61 6e 74 61 67 65 20 6f | the adv|antage o|
|000050d0| 66 20 63 6f 6e 63 65 6e | 74 72 61 74 69 6e 67 20 |f concen|trating |
|000050e0| 61 6c 6c 20 74 68 65 20 | 64 65 63 69 73 69 6f 6e |all the |decision|
|000050f0| 2d 0d 20 6d 61 6b 69 6e | 67 20 69 6e 20 6f 6e 65 |-. makin|g in one|
|00005100| 20 72 6f 75 74 69 6e 65 | 2c 20 61 73 20 6f 70 70 | routine|, as opp|
|00005110| 6f 73 65 64 20 74 6f 20 | 62 65 69 6e 67 20 73 70 |osed to |being sp|
|00005120| 72 65 61 64 20 74 68 72 | 6f 75 67 68 6f 75 74 20 |read thr|oughout |
|00005130| 74 68 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 2e |the appl|ication.|
|00005140| 0d 20 4f 74 68 65 72 20 | 61 70 70 6c 69 63 61 74 |. Other |applicat|
|00005150| 69 6f 6e 20 64 65 73 69 | 67 6e 73 20 6d 61 79 20 |ion desi|gns may |
|00005160| 74 61 6b 65 20 61 20 64 | 69 66 66 65 72 65 6e 74 |take a d|ifferent|
|00005170| 20 61 70 70 72 6f 61 63 | 68 20 74 68 61 74 20 6d | approac|h that m|
|00005180| 61 79 20 6f 72 20 6d 61 | 79 20 6e 6f 74 20 62 65 |ay or ma|y not be|
|00005190| 0d 20 6a 75 73 74 20 61 | 73 20 76 61 6c 69 64 2e |. just a|s valid.|
|000051a0| 7d 0d 0d 56 41 52 0d 09 | 77 69 6e 64 6f 77 09 09 |}..VAR..|window..|
|000051b0| 09 3a 20 57 69 6e 64 6f | 77 50 74 72 3b 0d 09 6d |.: Windo|wPtr;..m|
|000051c0| 65 6e 75 09 09 09 3a 20 | 4d 65 6e 75 48 61 6e 64 |enu...: |MenuHand|
|000051d0| 6c 65 3b 0d 0d 42 45 47 | 49 4e 0d 09 77 69 6e 64 |le;..BEG|IN..wind|
|000051e0| 6f 77 20 3a 3d 20 46 72 | 6f 6e 74 57 69 6e 64 6f |ow := Fr|ontWindo|
|000051f0| 77 3b 0d 0d 09 6d 65 6e | 75 20 3a 3d 20 47 65 74 |w;...men|u := Get|
|00005200| 4d 48 61 6e 64 6c 65 28 | 6d 46 69 6c 65 29 3b 0d |MHandle(|mFile);.|
|00005210| 09 49 46 20 49 73 44 41 | 57 69 6e 64 6f 77 28 77 |.IF IsDA|Window(w|
|00005220| 69 6e 64 6f 77 29 20 54 | 48 45 4e 09 09 09 09 7b |indow) T|HEN....{|
|00005230| 77 65 20 63 61 6e 20 61 | 6c 6c 6f 77 20 64 65 73 |we can a|llow des|
|00005240| 6b 20 61 63 63 65 73 73 | 6f 72 69 65 73 20 74 6f |k access|ories to|
|00005250| 20 62 65 20 63 6c 6f 73 | 65 64 20 66 72 6f 6d 20 | be clos|ed from |
|00005260| 74 68 65 20 6d 65 6e 75 | 7d 0d 09 09 45 6e 61 62 |the menu|}...Enab|
|00005270| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 43 6c |leItem(m|enu, iCl|
|00005280| 6f 73 65 29 0d 09 45 4c | 53 45 0d 09 09 44 69 73 |ose)..EL|SE...Dis|
|00005290| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|000052a0| 43 6c 6f 73 65 29 3b 09 | 09 09 7b 62 75 74 20 6e |Close);.|..{but n|
|000052b0| 6f 74 20 6f 75 72 20 74 | 72 61 66 66 69 63 20 6c |ot our t|raffic l|
|000052c0| 69 67 68 74 20 77 69 6e | 64 6f 77 7d 0d 0d 09 6d |ight win|dow}...m|
|000052d0| 65 6e 75 20 3a 3d 20 47 | 65 74 4d 48 61 6e 64 6c |enu := G|etMHandl|
|000052e0| 65 28 6d 45 64 69 74 29 | 3b 0d 09 49 46 20 49 73 |e(mEdit)|;..IF Is|
|000052f0| 44 41 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 29 |DAWindow|(window)|
|00005300| 20 54 48 45 4e 20 42 45 | 47 49 4e 09 09 7b 61 20 | THEN BE|GIN..{a |
|00005310| 64 65 73 6b 20 61 63 63 | 65 73 73 6f 72 79 20 6d |desk acc|essory m|
|00005320| 69 67 68 74 20 6e 65 65 | 64 20 74 68 65 20 65 64 |ight nee|d the ed|
|00005330| 69 74 20 6d 65 6e 75 7d | 0d 09 09 45 6e 61 62 6c |it menu}|...Enabl|
|00005340| 65 49 74 65 6d 28 6d 65 | 6e 75 2c 20 69 55 6e 64 |eItem(me|nu, iUnd|
|00005350| 6f 29 3b 0d 09 09 45 6e | 61 62 6c 65 49 74 65 6d |o);...En|ableItem|
|00005360| 28 6d 65 6e 75 2c 20 69 | 43 75 74 29 3b 0d 09 09 |(menu, i|Cut);...|
|00005370| 45 6e 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |EnableIt|em(menu,|
|00005380| 20 69 43 6f 70 79 29 3b | 0d 09 09 45 6e 61 62 6c | iCopy);|...Enabl|
|00005390| 65 49 74 65 6d 28 6d 65 | 6e 75 2c 20 69 50 61 73 |eItem(me|nu, iPas|
|000053a0| 74 65 29 3b 0d 09 09 45 | 6e 61 62 6c 65 49 74 65 |te);...E|nableIte|
|000053b0| 6d 28 6d 65 6e 75 2c 20 | 69 43 6c 65 61 72 29 3b |m(menu, |iClear);|
|000053c0| 0d 09 45 4e 44 20 45 4c | 53 45 20 42 45 47 49 4e |..END EL|SE BEGIN|
|000053d0| 09 09 09 09 09 09 09 7b | 62 75 74 20 77 65 20 6b |.......{|but we k|
|000053e0| 6e 6f 77 20 77 65 20 64 | 6f 20 6e 6f 74 7d 0d 09 |now we d|o not}..|
|000053f0| 09 44 69 73 61 62 6c 65 | 49 74 65 6d 28 6d 65 6e |.Disable|Item(men|
|00005400| 75 2c 20 69 55 6e 64 6f | 29 3b 0d 09 09 44 69 73 |u, iUndo|);...Dis|
|00005410| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|00005420| 43 75 74 29 3b 0d 09 09 | 44 69 73 61 62 6c 65 49 |Cut);...|DisableI|
|00005430| 74 65 6d 28 6d 65 6e 75 | 2c 20 69 43 6f 70 79 29 |tem(menu|, iCopy)|
|00005440| 3b 0d 09 09 44 69 73 61 | 62 6c 65 49 74 65 6d 28 |;...Disa|bleItem(|
|00005450| 6d 65 6e 75 2c 20 69 43 | 6c 65 61 72 29 3b 0d 09 |menu, iC|lear);..|
|00005460| 09 44 69 73 61 62 6c 65 | 49 74 65 6d 28 6d 65 6e |.Disable|Item(men|
|00005470| 75 2c 20 69 50 61 73 74 | 65 29 3b 0d 09 45 4e 44 |u, iPast|e);..END|
|00005480| 3b 0d 0d 09 6d 65 6e 75 | 20 3a 3d 20 47 65 74 4d |;...menu| := GetM|
|00005490| 48 61 6e 64 6c 65 28 6d | 4c 69 67 68 74 29 3b 0d |Handle(m|Light);.|
|000054a0| 09 49 46 20 49 73 41 70 | 70 57 69 6e 64 6f 77 28 |.IF IsAp|pWindow(|
|000054b0| 77 69 6e 64 6f 77 29 20 | 54 48 45 4e 20 42 45 47 |window) |THEN BEG|
|000054c0| 49 4e 09 09 7b 77 65 20 | 6b 6e 6f 77 20 74 68 61 |IN..{we |know tha|
|000054d0| 74 20 69 74 20 6d 75 73 | 74 20 62 65 20 74 68 65 |t it mus|t be the|
|000054e0| 20 74 72 61 66 66 69 63 | 20 6c 69 67 68 74 7d 0d | traffic| light}.|
|000054f0| 09 09 45 6e 61 62 6c 65 | 49 74 65 6d 28 6d 65 6e |..Enable|Item(men|
|00005500| 75 2c 20 69 53 74 6f 70 | 29 3b 0d 09 09 45 6e 61 |u, iStop|);...Ena|
|00005510| 62 6c 65 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 47 |bleItem(|menu, iG|
|00005520| 6f 29 3b 0d 09 45 4e 44 | 20 45 4c 53 45 20 42 45 |o);..END| ELSE BE|
|00005530| 47 49 4e 0d 09 09 44 69 | 73 61 62 6c 65 49 74 65 |GIN...Di|sableIte|
|00005540| 6d 28 6d 65 6e 75 2c 20 | 69 53 74 6f 70 29 3b 0d |m(menu, |iStop);.|
|00005550| 09 09 44 69 73 61 62 6c | 65 49 74 65 6d 28 6d 65 |..Disabl|eItem(me|
|00005560| 6e 75 2c 20 69 47 6f 29 | 3b 0d 09 45 4e 44 3b 0d |nu, iGo)|;..END;.|
|00005570| 09 43 68 65 63 6b 49 74 | 65 6d 28 6d 65 6e 75 2c |.CheckIt|em(menu,|
|00005580| 20 69 53 74 6f 70 2c 20 | 67 53 74 6f 70 70 65 64 | iStop, |gStopped|
|00005590| 29 3b 09 09 7b 77 65 20 | 63 61 6e 20 61 6c 73 6f |);..{we |can also|
|000055a0| 20 64 65 74 65 72 6d 69 | 6e 65 20 63 68 65 63 6b | determi|ne check|
|000055b0| 2f 75 6e 63 68 65 63 6b | 20 73 74 61 74 65 2c 20 |/uncheck| state, |
|000055c0| 74 6f 6f 7d 0d 09 43 68 | 65 63 6b 49 74 65 6d 28 |too}..Ch|eckItem(|
|000055d0| 6d 65 6e 75 2c 20 69 47 | 6f 2c 20 4e 4f 54 20 67 |menu, iG|o, NOT g|
|000055e0| 53 74 6f 70 70 65 64 29 | 3b 0d 45 4e 44 3b 20 7b |Stopped)|;.END; {|
|000055f0| 41 64 6a 75 73 74 4d 65 | 6e 75 73 7d 0d 0d 0d 7b |AdjustMe|nus}...{|
|00005600| 24 53 20 4d 61 69 6e 7d | 0d 50 52 4f 43 45 44 55 |$S Main}|.PROCEDU|
|00005610| 52 45 20 44 6f 4d 65 6e | 75 43 6f 6d 6d 61 6e 64 |RE DoMen|uCommand|
|00005620| 28 6d 65 6e 75 52 65 73 | 75 6c 74 3a 20 4c 4f 4e |(menuRes|ult: LON|
|00005630| 47 49 4e 54 29 3b 0d 0d | 7b 54 68 69 73 20 69 73 |GINT);..|{This is|
|00005640| 20 63 61 6c 6c 65 64 20 | 77 68 65 6e 20 61 6e 20 | called |when an |
|00005650| 69 74 65 6d 20 69 73 20 | 63 68 6f 73 65 6e 20 66 |item is |chosen f|
|00005660| 72 6f 6d 20 74 68 65 20 | 6d 65 6e 75 20 62 61 72 |rom the |menu bar|
|00005670| 20 28 61 66 74 65 72 20 | 63 61 6c 6c 69 6e 67 0d | (after |calling.|
|00005680| 20 4d 65 6e 75 53 65 6c | 65 63 74 20 6f 72 20 4d | MenuSel|ect or M|
|00005690| 65 6e 75 4b 65 79 29 2e | 20 49 74 20 70 65 72 66 |enuKey).| It perf|
|000056a0| 6f 72 6d 73 20 74 68 65 | 20 72 69 67 68 74 20 6f |orms the| right o|
|000056b0| 70 65 72 61 74 69 6f 6e | 20 66 6f 72 20 65 61 63 |peration| for eac|
|000056c0| 68 20 63 6f 6d 6d 61 6e | 64 2e 0d 20 49 74 20 69 |h comman|d.. It i|
|000056d0| 73 20 67 6f 6f 64 20 74 | 6f 20 68 61 76 65 20 62 |s good t|o have b|
|000056e0| 6f 74 68 20 74 68 65 20 | 72 65 73 75 6c 74 20 6f |oth the |result o|
|000056f0| 66 20 4d 65 6e 75 53 65 | 6c 65 63 74 20 61 6e 64 |f MenuSe|lect and|
|00005700| 20 4d 65 6e 75 4b 65 79 | 20 67 6f 20 74 6f 0d 20 | MenuKey| go to. |
|00005710| 6f 6e 65 20 72 6f 75 74 | 69 6e 65 20 6c 69 6b 65 |one rout|ine like|
|00005720| 20 74 68 69 73 20 74 6f | 20 6b 65 65 70 20 65 76 | this to| keep ev|
|00005730| 65 72 79 74 68 69 6e 67 | 20 6f 72 67 61 6e 69 7a |erything| organiz|
|00005740| 65 64 2e 7d 0d 0d 56 41 | 52 0d 09 6d 65 6e 75 49 |ed.}..VA|R..menuI|
|00005750| 44 09 09 09 3a 20 49 4e | 54 45 47 45 52 3b 09 09 |D...: IN|TEGER;..|
|00005760| 7b 74 68 65 20 72 65 73 | 6f 75 72 63 65 20 49 44 |{the res|ource ID|
|00005770| 20 6f 66 20 74 68 65 20 | 73 65 6c 65 63 74 65 64 | of the |selected|
|00005780| 20 6d 65 6e 75 7d 0d 09 | 6d 65 6e 75 49 74 65 6d | menu}..|menuItem|
|00005790| 09 09 3a 20 49 4e 54 45 | 47 45 52 3b 09 09 7b 74 |..: INTE|GER;..{t|
|000057a0| 68 65 20 69 74 65 6d 20 | 6e 75 6d 62 65 72 20 6f |he item |number o|
|000057b0| 66 20 74 68 65 20 73 65 | 6c 65 63 74 65 64 20 6d |f the se|lected m|
|000057c0| 65 6e 75 7d 0d 09 69 74 | 65 6d 48 69 74 09 09 09 |enu}..it|emHit...|
|000057d0| 3a 20 49 4e 54 45 47 45 | 52 3b 0d 09 64 61 4e 61 |: INTEGE|R;..daNa|
|000057e0| 6d 65 09 09 09 3a 20 53 | 74 72 32 35 35 3b 0d 09 |me...: S|tr255;..|
|000057f0| 64 61 52 65 66 4e 75 6d | 09 09 3a 20 49 4e 54 45 |daRefNum|..: INTE|
|00005800| 47 45 52 3b 0d 09 68 61 | 6e 64 6c 65 64 42 79 44 |GER;..ha|ndledByD|
|00005810| 41 09 09 3a 20 42 4f 4f | 4c 45 41 4e 3b 0d 09 69 |A..: BOO|LEAN;..i|
|00005820| 67 6e 6f 72 65 09 09 09 | 3a 20 42 4f 4f 4c 45 41 |gnore...|: BOOLEA|
|00005830| 4e 3b 0d 0d 42 45 47 49 | 4e 0d 09 6d 65 6e 75 49 |N;..BEGI|N..menuI|
|00005840| 44 20 3a 3d 20 48 69 57 | 72 64 28 6d 65 6e 75 52 |D := HiW|rd(menuR|
|00005850| 65 73 75 6c 74 29 3b 09 | 7b 75 73 65 20 62 75 69 |esult);.|{use bui|
|00005860| 6c 74 2d 69 6e 73 20 28 | 66 6f 72 20 65 66 66 69 |lt-ins (|for effi|
|00005870| 63 69 65 6e 63 79 29 2e | 2e 2e 7d 0d 09 6d 65 6e |ciency).|..}..men|
|00005880| 75 49 74 65 6d 20 3a 3d | 20 4c 6f 57 72 64 28 6d |uItem :=| LoWrd(m|
|00005890| 65 6e 75 52 65 73 75 6c | 74 29 3b 09 7b 74 6f 20 |enuResul|t);.{to |
|000058a0| 67 65 74 20 6d 65 6e 75 | 20 69 74 65 6d 20 6e 75 |get menu| item nu|
|000058b0| 6d 62 65 72 20 61 6e 64 | 20 6d 65 6e 75 20 6e 75 |mber and| menu nu|
|000058c0| 6d 62 65 72 7d 0d 09 43 | 41 53 45 20 6d 65 6e 75 |mber}..C|ASE menu|
|000058d0| 49 44 20 4f 46 0d 09 09 | 6d 41 70 70 6c 65 3a 0d |ID OF...|mApple:.|
|000058e0| 09 09 09 43 41 53 45 20 | 6d 65 6e 75 49 74 65 6d |...CASE |menuItem|
|000058f0| 20 4f 46 0d 09 09 09 09 | 69 41 62 6f 75 74 3a 09 | OF.....|iAbout:.|
|00005900| 09 09 09 7b 62 72 69 6e | 67 20 75 70 20 61 6c 65 |...{brin|g up ale|
|00005910| 72 74 20 66 6f 72 20 41 | 62 6f 75 74 7d 0d 09 09 |rt for A|bout}...|
|00005920| 09 09 09 69 74 65 6d 48 | 69 74 20 3a 3d 20 41 6c |...itemH|it := Al|
|00005930| 65 72 74 28 72 41 62 6f | 75 74 41 6c 65 72 74 2c |ert(rAbo|utAlert,|
|00005940| 20 4e 49 4c 29 3b 0d 09 | 09 09 09 4f 54 48 45 52 | NIL);..|...OTHER|
|00005950| 57 49 53 45 20 42 45 47 | 49 4e 09 09 7b 61 6c 6c |WISE BEG|IN..{all|
|00005960| 20 6e 6f 6e 2d 41 62 6f | 75 74 20 69 74 65 6d 73 | non-Abo|ut items|
|00005970| 20 69 6e 20 74 68 69 73 | 20 6d 65 6e 75 20 61 72 | in this| menu ar|
|00005980| 65 20 44 41 73 7d 0d 09 | 09 09 09 09 47 65 74 49 |e DAs}..|....GetI|
|00005990| 74 65 6d 28 47 65 74 4d | 48 61 6e 64 6c 65 28 6d |tem(GetM|Handle(m|
|000059a0| 41 70 70 6c 65 29 2c 20 | 6d 65 6e 75 49 74 65 6d |Apple), |menuItem|
|000059b0| 2c 20 64 61 4e 61 6d 65 | 29 3b 0d 09 09 09 09 09 |, daName|);......|
|000059c0| 64 61 52 65 66 4e 75 6d | 20 3a 3d 20 4f 70 65 6e |daRefNum| := Open|
|000059d0| 44 65 73 6b 41 63 63 28 | 64 61 4e 61 6d 65 29 3b |DeskAcc(|daName);|
|000059e0| 0d 09 09 09 09 45 4e 44 | 3b 0d 09 09 09 45 4e 44 |.....END|;....END|
|000059f0| 3b 0d 09 09 6d 46 69 6c | 65 3a 0d 09 09 09 43 41 |;...mFil|e:....CA|
|00005a00| 53 45 20 6d 65 6e 75 49 | 74 65 6d 20 4f 46 0d 09 |SE menuI|tem OF..|
|00005a10| 09 09 09 69 43 6c 6f 73 | 65 3a 0d 09 09 09 09 09 |...iClos|e:......|
|00005a20| 69 67 6e 6f 72 65 20 3a | 3d 20 44 6f 43 6c 6f 73 |ignore :|= DoClos|
|00005a30| 65 57 69 6e 64 6f 77 28 | 46 72 6f 6e 74 57 69 6e |eWindow(|FrontWin|
|00005a40| 64 6f 77 29 3b 20 7b 77 | 65 20 64 6f 6e 27 74 20 |dow); {w|e don't |
|00005a50| 63 61 72 65 20 69 66 20 | 63 61 6e 63 65 6c 6c 65 |care if |cancelle|
|00005a60| 64 7d 0d 09 09 09 09 69 | 51 75 69 74 3a 0d 09 09 |d}.....i|Quit:...|
|00005a70| 09 09 09 54 65 72 6d 69 | 6e 61 74 65 3b 0d 09 09 |...Termi|nate;...|
|00005a80| 09 45 4e 44 3b 0d 09 09 | 6d 45 64 69 74 3a 09 09 |.END;...|mEdit:..|
|00005a90| 09 09 09 09 7b 63 61 6c | 6c 20 53 79 73 74 65 6d |....{cal|l System|
|00005aa0| 45 64 69 74 20 66 6f 72 | 20 44 41 20 65 64 69 74 |Edit for| DA edit|
|00005ab0| 69 6e 67 20 26 20 4d 75 | 6c 74 69 46 69 6e 64 65 |ing & Mu|ltiFinde|
|00005ac0| 72 7d 0d 09 09 09 68 61 | 6e 64 6c 65 64 42 79 44 |r}....ha|ndledByD|
|00005ad0| 41 20 3a 3d 20 53 79 73 | 74 65 6d 45 64 69 74 28 |A := Sys|temEdit(|
|00005ae0| 6d 65 6e 75 49 74 65 6d | 2d 31 29 3b 09 7b 73 69 |menuItem|-1);.{si|
|00005af0| 6e 63 65 20 77 65 20 64 | 6f 6e 27 74 20 64 6f 20 |nce we d|on't do |
|00005b00| 61 6e 79 20 65 64 69 74 | 69 6e 67 7d 0d 09 09 6d |any edit|ing}...m|
|00005b10| 4c 69 67 68 74 3a 0d 09 | 09 09 43 41 53 45 20 6d |Light:..|..CASE m|
|00005b20| 65 6e 75 49 74 65 6d 20 | 4f 46 0d 09 09 09 09 69 |enuItem |OF.....i|
|00005b30| 53 74 6f 70 3a 0d 09 09 | 09 09 09 53 65 74 4c 69 |Stop:...|...SetLi|
|00005b40| 67 68 74 28 46 72 6f 6e | 74 57 69 6e 64 6f 77 2c |ght(Fron|tWindow,|
|00005b50| 20 54 52 55 45 29 3b 0d | 09 09 09 09 69 47 6f 3a | TRUE);.|....iGo:|
|00005b60| 0d 09 09 09 09 09 53 65 | 74 4c 69 67 68 74 28 46 |......Se|tLight(F|
|00005b70| 72 6f 6e 74 57 69 6e 64 | 6f 77 2c 20 46 41 4c 53 |rontWind|ow, FALS|
|00005b80| 45 29 3b 0d 09 09 09 45 | 4e 44 3b 0d 09 45 4e 44 |E);....E|ND;..END|
|00005b90| 3b 0d 09 48 69 6c 69 74 | 65 4d 65 6e 75 28 30 29 |;..Hilit|eMenu(0)|
|00005ba0| 3b 09 09 09 09 09 7b 75 | 6e 68 69 67 68 6c 69 67 |;.....{u|nhighlig|
|00005bb0| 68 74 20 77 68 61 74 20 | 4d 65 6e 75 53 65 6c 65 |ht what |MenuSele|
|00005bc0| 63 74 20 28 6f 72 20 4d | 65 6e 75 4b 65 79 29 20 |ct (or M|enuKey) |
|00005bd0| 68 69 6c 69 74 65 64 7d | 0d 45 4e 44 3b 20 7b 44 |hilited}|.END; {D|
|00005be0| 6f 4d 65 6e 75 43 6f 6d | 6d 61 6e 64 7d 0d 0d 0d |oMenuCom|mand}...|
|00005bf0| 7b 24 53 20 4d 61 69 6e | 7d 0d 50 52 4f 43 45 44 |{$S Main|}.PROCED|
|00005c00| 55 52 45 20 44 72 61 77 | 57 69 6e 64 6f 77 28 77 |URE Draw|Window(w|
|00005c10| 69 6e 64 6f 77 3a 20 57 | 69 6e 64 6f 77 50 74 72 |indow: W|indowPtr|
|00005c20| 29 3b 0d 0d 7b 44 72 61 | 77 20 74 68 65 20 63 6f |);..{Dra|w the co|
|00005c30| 6e 74 65 6e 74 73 20 6f | 66 20 74 68 65 20 61 70 |ntents o|f the ap|
|00005c40| 70 6c 69 63 61 74 69 6f | 6e 20 77 69 6e 64 6f 77 |plicatio|n window|
|00005c50| 2e 20 57 65 20 64 6f 20 | 73 6f 6d 65 20 64 72 61 |. We do |some dra|
|00005c60| 77 69 6e 67 20 69 6e 20 | 63 6f 6c 6f 72 2c 20 75 |wing in |color, u|
|00005c70| 73 69 6e 67 0d 20 43 6c | 61 73 73 69 63 20 51 75 |sing. Cl|assic Qu|
|00005c80| 69 63 6b 44 72 61 77 27 | 73 20 63 6f 6c 6f 72 20 |ickDraw'|s color |
|00005c90| 63 61 70 61 62 69 6c 69 | 74 69 65 73 2e 20 54 68 |capabili|ties. Th|
|00005ca0| 69 73 20 77 69 6c 6c 20 | 62 65 20 62 6c 61 63 6b |is will |be black|
|00005cb0| 20 61 6e 64 20 77 68 69 | 74 65 20 6f 6e 20 6f 6c | and whi|te on ol|
|00005cc0| 64 0d 20 6d 61 63 68 69 | 6e 65 73 2c 20 62 75 74 |d. machi|nes, but|
|00005cd0| 20 63 6f 6c 6f 72 20 6f | 6e 20 63 6f 6c 6f 72 20 | color o|n color |
|00005ce0| 6d 61 63 68 69 6e 65 73 | 2e 20 41 74 20 74 68 69 |machines|. At thi|
|00005cf0| 73 20 70 6f 69 6e 74 2c | 20 74 68 65 20 77 69 6e |s point,| the win|
|00005d00| 64 6f 77 27 73 20 76 69 | 73 52 67 6e 20 69 73 0d |dow's vi|sRgn is.|
|00005d10| 20 73 65 74 20 74 6f 20 | 61 6c 6c 6f 77 20 64 72 | set to |allow dr|
|00005d20| 61 77 69 6e 67 20 6f 6e | 6c 79 20 77 68 65 72 65 |awing on|ly where|
|00005d30| 20 69 74 20 6e 65 65 64 | 73 20 74 6f 20 62 65 20 | it need|s to be |
|00005d40| 64 6f 6e 65 2e 7d 0d 0d | 42 45 47 49 4e 0d 09 53 |done.}..|BEGIN..S|
|00005d50| 65 74 50 6f 72 74 28 77 | 69 6e 64 6f 77 29 3b 0d |etPort(w|indow);.|
|00005d60| 0d 09 45 72 61 73 65 52 | 65 63 74 28 77 69 6e 64 |..EraseR|ect(wind|
|00005d70| 6f 77 5e 2e 70 6f 72 74 | 52 65 63 74 29 3b 09 7b |ow^.port|Rect);.{|
|00005d80| 63 6c 65 61 72 20 6f 75 | 74 20 61 6e 79 20 67 61 |clear ou|t any ga|
|00005d90| 72 62 61 67 65 20 74 68 | 61 74 20 6d 69 67 68 74 |rbage th|at might|
|00005da0| 20 62 65 20 6c 65 66 74 | 20 62 65 68 69 6e 64 7d | be left| behind}|
|00005db0| 0d 09 49 46 20 67 53 74 | 6f 70 70 65 64 20 54 48 |..IF gSt|opped TH|
|00005dc0| 45 4e 09 09 09 09 7b 64 | 72 61 77 20 61 20 72 65 |EN....{d|raw a re|
|00005dd0| 64 20 28 6f 72 20 77 68 | 69 74 65 29 20 73 74 6f |d (or wh|ite) sto|
|00005de0| 70 20 6c 69 67 68 74 7d | 0d 09 09 46 6f 72 65 43 |p light}|...ForeC|
|00005df0| 6f 6c 6f 72 28 72 65 64 | 43 6f 6c 6f 72 29 0d 09 |olor(red|Color)..|
|00005e00| 45 4c 53 45 0d 09 09 46 | 6f 72 65 43 6f 6c 6f 72 |ELSE...F|oreColor|
|00005e10| 28 77 68 69 74 65 43 6f | 6c 6f 72 29 3b 0d 09 50 |(whiteCo|lor);..P|
|00005e20| 61 69 6e 74 4f 76 61 6c | 28 67 53 74 6f 70 52 65 |aintOval|(gStopRe|
|00005e30| 63 74 29 3b 0d 09 46 6f | 72 65 43 6f 6c 6f 72 28 |ct);..Fo|reColor(|
|00005e40| 62 6c 61 63 6b 43 6f 6c | 6f 72 29 3b 0d 09 46 72 |blackCol|or);..Fr|
|00005e50| 61 6d 65 4f 76 61 6c 28 | 67 53 74 6f 70 52 65 63 |ameOval(|gStopRec|
|00005e60| 74 29 3b 0d 09 49 46 20 | 4e 4f 54 20 67 53 74 6f |t);..IF |NOT gSto|
|00005e70| 70 70 65 64 20 54 48 45 | 4e 09 09 09 7b 64 72 61 |pped THE|N...{dra|
|00005e80| 77 20 61 20 67 72 65 65 | 6e 20 28 6f 72 20 77 68 |w a gree|n (or wh|
|00005e90| 69 74 65 29 20 67 6f 20 | 6c 69 67 68 74 7d 0d 09 |ite) go |light}..|
|00005ea0| 09 46 6f 72 65 43 6f 6c | 6f 72 28 67 72 65 65 6e |.ForeCol|or(green|
|00005eb0| 43 6f 6c 6f 72 29 0d 09 | 45 4c 53 45 0d 09 09 46 |Color)..|ELSE...F|
|00005ec0| 6f 72 65 43 6f 6c 6f 72 | 28 77 68 69 74 65 43 6f |oreColor|(whiteCo|
|00005ed0| 6c 6f 72 29 3b 0d 09 50 | 61 69 6e 74 4f 76 61 6c |lor);..P|aintOval|
|00005ee0| 28 67 47 6f 52 65 63 74 | 29 3b 0d 09 46 6f 72 65 |(gGoRect|);..Fore|
|00005ef0| 43 6f 6c 6f 72 28 62 6c | 61 63 6b 43 6f 6c 6f 72 |Color(bl|ackColor|
|00005f00| 29 3b 0d 09 46 72 61 6d | 65 4f 76 61 6c 28 67 47 |);..Fram|eOval(gG|
|00005f10| 6f 52 65 63 74 29 3b 0d | 45 4e 44 3b 20 7b 44 72 |oRect);.|END; {Dr|
|00005f20| 61 77 57 69 6e 64 6f 77 | 7d 0d 0d 0d 7b 24 53 20 |awWindow|}...{$S |
|00005f30| 4d 61 69 6e 7d 0d 50 52 | 4f 43 45 44 55 52 45 20 |Main}.PR|OCEDURE |
|00005f40| 44 6f 43 6f 6e 74 65 6e | 74 43 6c 69 63 6b 28 77 |DoConten|tClick(w|
|00005f50| 69 6e 64 6f 77 3a 20 57 | 69 6e 64 6f 77 50 74 72 |indow: W|indowPtr|
|00005f60| 3b 20 65 76 65 6e 74 3a | 20 45 76 65 6e 74 52 65 |; event:| EventRe|
|00005f70| 63 6f 72 64 29 3b 0d 0d | 7b 54 68 69 73 20 69 73 |cord);..|{This is|
|00005f80| 20 63 61 6c 6c 65 64 20 | 77 68 65 6e 20 61 20 6d | called |when a m|
|00005f90| 6f 75 73 65 2d 64 6f 77 | 6e 20 65 76 65 6e 74 20 |ouse-dow|n event |
|00005fa0| 6f 63 63 75 72 73 20 69 | 6e 20 74 68 65 20 63 6f |occurs i|n the co|
|00005fb0| 6e 74 65 6e 74 20 6f 66 | 20 61 20 77 69 6e 64 6f |ntent of| a windo|
|00005fc0| 77 2e 0d 20 4f 74 68 65 | 72 20 61 70 70 6c 69 63 |w.. Othe|r applic|
|00005fd0| 61 74 69 6f 6e 73 20 6d | 69 67 68 74 20 77 61 6e |ations m|ight wan|
|00005fe0| 74 20 74 6f 20 63 61 6c | 6c 20 46 69 6e 64 43 6f |t to cal|l FindCo|
|00005ff0| 6e 74 72 6f 6c 2c 20 54 | 45 43 6c 69 63 6b 2c 20 |ntrol, T|EClick, |
|00006000| 65 74 63 2e 2c 20 74 6f | 0d 20 66 75 72 74 68 65 |etc., to|. furthe|
|00006010| 72 20 70 72 6f 63 65 73 | 73 20 74 68 65 20 63 6c |r proces|s the cl|
|00006020| 69 63 6b 2e 7d 0d 0d 42 | 45 47 49 4e 0d 09 53 65 |ick.}..B|EGIN..Se|
|00006030| 74 4c 69 67 68 74 28 77 | 69 6e 64 6f 77 2c 20 4e |tLight(w|indow, N|
|00006040| 4f 54 20 67 53 74 6f 70 | 70 65 64 29 3b 0d 45 4e |OT gStop|ped);.EN|
|00006050| 44 3b 20 7b 44 6f 43 6f | 6e 74 65 6e 74 43 6c 69 |D; {DoCo|ntentCli|
|00006060| 63 6b 7d 0d 0d 0d 7b 24 | 53 20 4d 61 69 6e 7d 0d |ck}...{$|S Main}.|
|00006070| 50 52 4f 43 45 44 55 52 | 45 20 44 6f 55 70 64 61 |PROCEDUR|E DoUpda|
|00006080| 74 65 28 77 69 6e 64 6f | 77 3a 20 57 69 6e 64 6f |te(windo|w: Windo|
|00006090| 77 50 74 72 29 3b 0d 0d | 7b 54 68 69 73 20 69 73 |wPtr);..|{This is|
|000060a0| 20 63 61 6c 6c 65 64 20 | 77 68 65 6e 20 61 6e 20 | called |when an |
|000060b0| 75 70 64 61 74 65 20 65 | 76 65 6e 74 20 69 73 20 |update e|vent is |
|000060c0| 72 65 63 65 69 76 65 64 | 20 66 6f 72 20 61 20 77 |received| for a w|
|000060d0| 69 6e 64 6f 77 2e 0d 20 | 49 74 20 63 61 6c 6c 73 |indow.. |It calls|
|000060e0| 20 44 72 61 77 57 69 6e | 64 6f 77 20 74 6f 20 64 | DrawWin|dow to d|
|000060f0| 72 61 77 20 74 68 65 20 | 63 6f 6e 74 65 6e 74 73 |raw the |contents|
|00006100| 20 6f 66 20 61 6e 20 61 | 70 70 6c 69 63 61 74 69 | of an a|pplicati|
|00006110| 6f 6e 20 77 69 6e 64 6f | 77 2e 0d 20 41 73 20 61 |on windo|w.. As a|
|00006120| 6e 20 65 66 66 65 63 69 | 65 6e 63 79 20 6d 65 61 |n effeci|ency mea|
|00006130| 73 75 72 65 20 74 68 61 | 74 20 64 6f 65 73 20 6e |sure tha|t does n|
|00006140| 6f 74 20 68 61 76 65 20 | 74 6f 20 62 65 20 66 6f |ot have |to be fo|
|00006150| 6c 6c 6f 77 65 64 2c 20 | 69 74 0d 20 63 61 6c 6c |llowed, |it. call|
|00006160| 73 20 74 68 65 20 64 72 | 61 77 69 6e 67 20 72 6f |s the dr|awing ro|
|00006170| 75 74 69 6e 65 20 6f 6e | 6c 79 20 69 66 20 74 68 |utine on|ly if th|
|00006180| 65 20 76 69 73 52 67 6e | 20 69 73 20 6e 6f 6e 2d |e visRgn| is non-|
|00006190| 65 6d 70 74 79 2e 20 54 | 68 69 73 0d 20 77 69 6c |empty. T|his. wil|
|000061a0| 6c 20 68 61 6e 64 6c 65 | 20 73 69 74 75 61 74 69 |l handle| situati|
|000061b0| 6f 6e 73 20 77 68 65 72 | 65 20 63 61 6c 63 75 6c |ons wher|e calcul|
|000061c0| 61 74 69 6f 6e 73 20 66 | 6f 72 20 64 72 61 77 69 |ations f|or drawi|
|000061d0| 6e 67 20 6f 72 20 64 72 | 61 77 69 6e 67 0d 20 69 |ng or dr|awing. i|
|000061e0| 74 73 65 6c 66 20 69 73 | 20 76 65 72 79 20 74 69 |tself is| very ti|
|000061f0| 6d 65 2d 63 6f 6e 73 75 | 6d 69 6e 67 2e 7d 0d 0d |me-consu|ming.}..|
|00006200| 42 45 47 49 4e 0d 09 49 | 46 20 49 73 41 70 70 57 |BEGIN..I|F IsAppW|
|00006210| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 20 54 48 |indow(wi|ndow) TH|
|00006220| 45 4e 20 42 45 47 49 4e | 0d 09 09 42 65 67 69 6e |EN BEGIN|...Begin|
|00006230| 55 70 64 61 74 65 28 77 | 69 6e 64 6f 77 29 3b 09 |Update(w|indow);.|
|00006240| 09 09 09 09 7b 73 65 74 | 73 20 75 70 20 74 68 65 |....{set|s up the|
|00006250| 20 76 69 73 52 67 6e 2c | 20 63 6c 65 61 72 73 20 | visRgn,| clears |
|00006260| 75 70 64 61 74 65 52 67 | 6e 7d 0d 09 09 49 46 20 |updateRg|n}...IF |
|00006270| 4e 4f 54 20 45 6d 70 74 | 79 52 67 6e 28 77 69 6e |NOT Empt|yRgn(win|
|00006280| 64 6f 77 5e 2e 76 69 73 | 52 67 6e 29 20 54 48 45 |dow^.vis|Rgn) THE|
|00006290| 4e 09 7b 64 72 61 77 20 | 69 66 20 75 70 64 61 74 |N.{draw |if updat|
|000062a0| 69 6e 67 20 6e 65 65 64 | 73 20 74 6f 20 62 65 20 |ing need|s to be |
|000062b0| 64 6f 6e 65 7d 0d 09 09 | 09 44 72 61 77 57 69 6e |done}...|.DrawWin|
|000062c0| 64 6f 77 28 77 69 6e 64 | 6f 77 29 3b 0d 09 09 45 |dow(wind|ow);...E|
|000062d0| 6e 64 55 70 64 61 74 65 | 28 77 69 6e 64 6f 77 29 |ndUpdate|(window)|
|000062e0| 3b 09 09 09 09 09 09 7b | 72 65 73 74 6f 72 65 73 |;......{|restores|
|000062f0| 20 74 68 65 20 76 69 73 | 52 67 6e 7d 0d 09 45 4e | the vis|Rgn}..EN|
|00006300| 44 3b 0d 45 4e 44 3b 20 | 7b 44 6f 55 70 64 61 74 |D;.END; |{DoUpdat|
|00006310| 65 7d 0d 0d 0d 7b 24 53 | 20 4d 61 69 6e 7d 0d 50 |e}...{$S| Main}.P|
|00006320| 52 4f 43 45 44 55 52 45 | 20 44 6f 41 63 74 69 76 |ROCEDURE| DoActiv|
|00006330| 61 74 65 28 77 69 6e 64 | 6f 77 3a 20 57 69 6e 64 |ate(wind|ow: Wind|
|00006340| 6f 77 50 74 72 3b 20 62 | 65 63 6f 6d 69 6e 67 41 |owPtr; b|ecomingA|
|00006350| 63 74 69 76 65 3a 20 42 | 4f 4f 4c 45 41 4e 29 3b |ctive: B|OOLEAN);|
|00006360| 0d 0d 7b 54 68 69 73 20 | 69 73 20 63 61 6c 6c 65 |..{This |is calle|
|00006370| 64 20 77 68 65 6e 20 61 | 20 77 69 6e 64 6f 77 20 |d when a| window |
|00006380| 69 73 20 61 63 74 69 76 | 61 74 65 64 20 6f 72 20 |is activ|ated or |
|00006390| 64 65 61 63 74 69 76 61 | 74 65 64 2e 0d 20 49 6e |deactiva|ted.. In|
|000063a0| 20 53 61 6d 70 6c 65 2c | 20 74 68 65 20 57 69 6e | Sample,| the Win|
|000063b0| 64 6f 77 20 4d 61 6e 61 | 67 65 72 27 73 20 68 61 |dow Mana|ger's ha|
|000063c0| 6e 64 6c 69 6e 67 20 6f | 66 20 61 63 74 69 76 61 |ndling o|f activa|
|000063d0| 74 65 20 61 6e 64 0d 20 | 64 65 61 63 74 69 76 61 |te and. |deactiva|
|000063e0| 74 65 20 65 76 65 6e 74 | 73 20 69 73 20 73 75 66 |te event|s is suf|
|000063f0| 66 69 63 69 65 6e 74 2e | 20 4f 74 68 65 72 20 61 |ficient.| Other a|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.